diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 1881bb12f7..39494f3257 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -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); diff --git a/test/functional/rpc_psbt.py b/test/functional/rpc_psbt.py index 8aff333b42..0365bc7d41 100755 --- a/test/functional/rpc_psbt.py +++ b/test/functional/rpc_psbt.py @@ -257,6 +257,10 @@ def run_basic_tests(self, confidential): 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)