Skip to content

Commit a0dd291

Browse files
committed
Add default current block height locktime for wallet fingerprinting
This adds a default locktime to the payjoin-cli for the purpose of demonstrating good wallet fingerprinting practices. For demonstrating wallet fingerprinting in external wallet integrations I think it is important for the cli to be opinionated about how every aspect of wallet creation is a way to give up some privacy. This default is the current block height + 1 to be inline with bitcoin core anti-fee-sniping.
1 parent 49a680b commit a0dd291

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

payjoin-cli/src/app/wallet.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ impl BitcoindWallet {
5353
conf_target: None,
5454
};
5555

56+
// Set locktime to current block height for anti-fee-sniping
57+
// This is to follow wallet fingerprinting best practices and set and opinionated
58+
// default for external wallet integrations to follow along with
59+
let locktime = Some(tokio::task::block_in_place(|| {
60+
tokio::runtime::Handle::current().block_on(async { self.rpc.get_block_count().await })
61+
})? as u32);
62+
5663
// Sync wrapper around async call - use tokio handle to avoid deadlock
5764
let result = tokio::task::block_in_place(|| {
5865
tokio::runtime::Handle::current().block_on(async {
@@ -66,7 +73,7 @@ impl BitcoindWallet {
6673
amount: v.to_btc(),
6774
})
6875
.collect::<Vec<_>>(),
69-
None, // locktime
76+
locktime,
7077
Some(options),
7178
None,
7279
)

0 commit comments

Comments
 (0)