Skip to content

Commit 9946cac

Browse files
committed
taprpc: add file anchor tx block hash to AssetTransfer
This commit introduces the anchor transaction block hash as a field in the `AssetTransfer` RPC message. The `ListTransfers` RPC endpoint now includes this block hash for each asset transfer, provided the anchor transaction is confirmed. If the transaction is unconfirmed, this field will remain unset.
1 parent ef4011a commit 9946cac

File tree

5 files changed

+588
-552
lines changed

5 files changed

+588
-552
lines changed

rpcserver.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3379,11 +3379,19 @@ func marshalOutboundParcel(
33793379
}
33803380

33813381
anchorTxHash := parcel.AnchorTx.TxHash()
3382+
3383+
// Marshal the anchor tx block hash.
3384+
var anchorTxBlockHashBytes []byte
3385+
parcel.AnchorTxBlockHash.WhenSome(func(hash chainhash.Hash) {
3386+
anchorTxBlockHashBytes = hash[:]
3387+
})
3388+
33823389
return &taprpc.AssetTransfer{
33833390
TransferTimestamp: parcel.TransferTime.Unix(),
33843391
AnchorTxHash: anchorTxHash[:],
33853392
AnchorTxHeightHint: parcel.AnchorTxHeightHint,
33863393
AnchorTxChainFees: parcel.ChainFees,
3394+
AnchorTxBlockHash: anchorTxBlockHashBytes,
33873395
Inputs: rpcInputs,
33883396
Outputs: rpcOutputs,
33893397
}, nil

taprpc/assetwalletrpc/assetwallet.swagger.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,11 @@
871871
"$ref": "#/definitions/taprpcTransferOutput"
872872
},
873873
"description": "Describes the set of newly created asset outputs."
874+
},
875+
"anchor_tx_block_hash": {
876+
"type": "string",
877+
"format": "byte",
878+
"description": "The block hash the contains the anchor transaction above. If unset, the\nanchor transaction is unconfirmed."
874879
}
875880
}
876881
},

0 commit comments

Comments
 (0)