mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-13 12:33:42 +02:00
Merge pull request #1372 from delta1/issues-1371
decodepsbt: add asset/assetcommitment to input.witness_utxo
This commit is contained in:
commit
22089ac8f6
2 changed files with 9 additions and 0 deletions
|
|
@ -1475,6 +1475,11 @@ static RPCHelpMan decodepsbt()
|
|||
} else {
|
||||
out.pushKV("amountcommitment", txout.nValue.GetHex());
|
||||
}
|
||||
if (txout.nAsset.IsExplicit()) {
|
||||
out.pushKV("asset", txout.nAsset.GetAsset().GetHex());
|
||||
} else {
|
||||
out.pushKV("assetcommitment", txout.nAsset.GetHex());
|
||||
}
|
||||
out.pushKV("scriptPubKey", o);
|
||||
|
||||
in.pushKV("witness_utxo", out);
|
||||
|
|
|
|||
|
|
@ -257,6 +257,10 @@ class PSBTTest(BitcoinTestFramework):
|
|||
decoded = self.nodes[1].decodepsbt(walletsignpsbt_out['psbt'])
|
||||
assert 'non_witness_utxo' in decoded['inputs'][0]
|
||||
assert 'witness_utxo' in decoded['inputs'][0]
|
||||
if 'asset' in decoded['inputs'][0]['witness_utxo']:
|
||||
assert_equal(decoded['inputs'][0]['witness_utxo']['asset'], 'b2e15d0d7a0c94e4e2ce0fe6e8691b9e451377f6e46e8045a86f7c4b5d4f0f23')
|
||||
else:
|
||||
assert 'assetcommitment' in decoded['inputs'][0]['witness_utxo']
|
||||
# Check decodepsbt fee calculation (input values shall only be counted once per UTXO)
|
||||
#assert_equal(decoded['fee'], created_psbt['fee']) # ELEMENTS: we do not have this field. Should be fixed by #900
|
||||
assert_equal(walletsignpsbt_out['complete'], True)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue