mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-02 18:25:21 +00:00
transaction: simply PartialTransaction constructor
rm footgun (see prev commit)
This commit is contained in:
parent
54d2fa0e7d
commit
13fe8e466d
1 changed files with 4 additions and 4 deletions
|
@ -1539,8 +1539,8 @@ class PartialTxOutput(TxOutput, PSBTSection):
|
||||||
|
|
||||||
class PartialTransaction(Transaction):
|
class PartialTransaction(Transaction):
|
||||||
|
|
||||||
def __init__(self, raw_unsigned_tx):
|
def __init__(self):
|
||||||
Transaction.__init__(self, raw_unsigned_tx)
|
Transaction.__init__(self, None)
|
||||||
self.xpubs = {} # type: Dict[BIP32Node, Tuple[bytes, Sequence[int]]] # intermediate bip32node -> (xfp, der_prefix)
|
self.xpubs = {} # type: Dict[BIP32Node, Tuple[bytes, Sequence[int]]] # intermediate bip32node -> (xfp, der_prefix)
|
||||||
self._inputs = [] # type: List[PartialTxInput]
|
self._inputs = [] # type: List[PartialTxInput]
|
||||||
self._outputs = [] # type: List[PartialTxOutput]
|
self._outputs = [] # type: List[PartialTxOutput]
|
||||||
|
@ -1557,7 +1557,7 @@ class PartialTransaction(Transaction):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_tx(cls, tx: Transaction) -> 'PartialTransaction':
|
def from_tx(cls, tx: Transaction) -> 'PartialTransaction':
|
||||||
res = cls(None)
|
res = cls()
|
||||||
res._inputs = [PartialTxInput.from_txin(txin) for txin in tx.inputs()]
|
res._inputs = [PartialTxInput.from_txin(txin) for txin in tx.inputs()]
|
||||||
res._outputs = [PartialTxOutput.from_txout(txout) for txout in tx.outputs()]
|
res._outputs = [PartialTxOutput.from_txout(txout) for txout in tx.outputs()]
|
||||||
res.version = tx.version
|
res.version = tx.version
|
||||||
|
@ -1664,7 +1664,7 @@ class PartialTransaction(Transaction):
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_io(cls, inputs: Sequence[PartialTxInput], outputs: Sequence[PartialTxOutput], *,
|
def from_io(cls, inputs: Sequence[PartialTxInput], outputs: Sequence[PartialTxOutput], *,
|
||||||
locktime: int = None, version: int = None):
|
locktime: int = None, version: int = None):
|
||||||
self = cls(None)
|
self = cls()
|
||||||
self._inputs = list(inputs)
|
self._inputs = list(inputs)
|
||||||
self._outputs = list(outputs)
|
self._outputs = list(outputs)
|
||||||
if locktime is not None:
|
if locktime is not None:
|
||||||
|
|
Loading…
Add table
Reference in a new issue