-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Wrong timestamps when using fulcrum #129
Comments
Potential theory: The client is assuming batch results come back in the exact order of the batch request. As per the JSON-RPC spec, this is not necessarily what all servers do:
As such, Fulcrum returns batch results in an unspecified order (internally the results array is built as the results come in from an asynchronous task, which is why they are in a jumbled order). Likely the client is assuming the batch results are in the same order as the batch request? Maybe? |
with the 1.0 beta2 I cannot reproduce the bug. I assume it is solved. import bdkpython as bdk
import datetime
network = bdk.bitcoin.Network.BITCOIN
electrum = bdk.bdk.ElectrumClient("my-server:50001")
mnemonic = bdk.Mnemonic.from_string('bacon '*24)
print(mnemonic )
descriptor = bdk.Descriptor.new_bip84(
secret_key=bdk.DescriptorSecretKey(network, mnemonic, ''),
keychain=bdk.KeychainKind.EXTERNAL,
network=network,
)
change_descriptor = bdk.Descriptor.new_bip84(
secret_key=bdk.DescriptorSecretKey(network, mnemonic, ''),
keychain=bdk.KeychainKind.INTERNAL,
network=network,
)
print(f'xpub {descriptor }')
wallet = bdk.Wallet(
descriptor=descriptor,
change_descriptor=change_descriptor,
network=network,
connection=bdk.Connection.new_in_memory()
)
sync_request_builder =wallet.start_full_scan()
sync_update = electrum.full_scan(sync_request_builder.build(), stop_gap=10, batch_size=1, fetch_prev_txouts=True)
wallet.apply_update(sync_update)
balance = wallet.balance()
print(f"Wallet balance is: {balance.total.to_sat()}")
for tx in wallet.transactions():
print(tx.chain_position.confirmation_block_time.block_id.height, tx.chain_position.confirmation_block_time.confirmation_time,
datetime.datetime.fromtimestamp(tx.chain_position.confirmation_block_time.confirmation_time).strftime("%Y-%m-%d %H:%M"),
tx.transaction.compute_txid()) |
Some of the timestamps of bdk
list_transactions
are wrong. Using bdkpython 0.31.0 I query my fulcrum mainnet bitcoin server (Fulcrum version: 1.9.7) withthis gives
where the marked row
has the time: 2023-01-18 06:25
However it should be 2023-09-24 13:57
The row above the marked one has however the correct timestamp.
the error is not determinstic, with repeated executions I get different timestamps
and it appears that the timestamps are mixed up between the different txs
Originally opened in fulcrum: cculianu/Fulcrum#233
The text was updated successfully, but these errors were encountered: