-
Notifications
You must be signed in to change notification settings - Fork 446
Transactions inserted with Wallet::insert_tx will be replaced by the wallet when creating a new tx. #1642
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't workingdiscussionThere's still a discussion ongoingThere's still a discussion ongoing
Milestone
Description
Describe the bug
When a caller manually inserts a transaction into wallet via Wallet::insert_tx, it is an intuitive assumption that the transaction inserted will not be replaced by a new transaction created with Wallet::build_tx.
However, the current default behavior of Wallet::build_tx replaces the transaction inserted with Wallet::insert_tx since purely inserting a transaction without a last_seen or Anchor to the best chain means that the tx will not be part of the canonical chain.
Thank you @stevenroose for bringing this to my attention. Am I missing anything here?
To Reproduce
Some simple steps for reproducing.
- Create a wallet with a single UTXO.
- Create a tx (
T1) from that wallet and send to foreign address A. - Insert
T1into the wallet viaWallet::insert_tx. - Create another tx (
T2) that sends to foreign address B. - Compare inputs of A & B. They should not be the same - but they are.
Proposed solutions
- Add another parameter to
insert_tx:last_seen: Option<u64>, and document that we need the last_seen value in order for the tx to be seen in the canonical chain. - Have wallet keep track of which transactions it has created. We shouldn't be replacing transactions that we create.
I think 1. should be the solution for now. 2. will need more thinking.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingdiscussionThere's still a discussion ongoingThere's still a discussion ongoing
Type
Projects
Status
Done