bdk icon indicating copy to clipboard operation
bdk copied to clipboard

Ordering of transactions within the same block

Open cryptoquick opened this issue 3 years ago • 1 comments
trafficstars

Describe the enhancement
Presently, there's an example of how to sort transactions from the .list_transactions method by block height, but I'm not sure if there's a good way for transactions to be sorted in causal order if multiple wallet internal transactions are included within the same block.

Use case
This would be desirable for, say, coin consolidation, or spending funds as soon as they were sent to you, (the onus as usual is on the receiver to determine if there are enough confirmations for them to confirm they've been paid).

Additional context See this screenshot: Screenshot from 2022-10-05 06-39-07

And here are the transactions on testnet being made within the same block (2348574): https://mempool.space/testnet/tx/20820b9e6600bbc6cb8fbf2b5474f28e3ffb118eb59005ea5f4ecc4bd022ba01 https://mempool.space/testnet/tx/b476a5a43b94f7461d9db18a6890440a2dcc8629d8081e7dadeaa947bf0dc245 https://mempool.space/testnet/tx/3c0fe56cf3fb0daa64d3c7afcfbf7d5ca8d7aca986bcfdc26bac4a692f6b3fd3 https://mempool.space/testnet/tx/981fa7d547c725a60e29920472af760831ffcb4dee22ec00c21c36fb670babf6

cryptoquick avatar Oct 05 '22 13:10 cryptoquick

Maybe we should just have list_transactions returning an ordered list. This should be doable in bdk 1.0, but probably not before.

danielabrozzoni avatar Oct 05 '22 14:10 danielabrozzoni