Commit graph

207 commits

Author SHA1 Message Date
Olaoluwa Osuntokun
7d0d499cd0
wallet: remove txns from store if they're in the chain, or have a negative output 2018-08-22 20:20:54 -07:00
Olaoluwa Osuntokun
1fbdc8c44b
wallet: catch and return error from rollback failure 2018-08-14 18:17:47 -07:00
Wilmer Paulino
dec9978ca2 wallet: stop handling chain notifications once wallet has stopped
In this commit, we alter the behavior for handling chain notifications
within the wallet. The previous code would assume that the channel would
close, but due to now using a ConcurrentQueue to handle notifications,
this assumption no longer stands. Now, we'll stop handling notifications
either once the wallet has or stopped or once the notifications channel
has been closed.
2018-07-30 17:54:08 -07:00
Wilmer Paulino
bbb5a6c058 wallet: remove the need to set the birthday for bitcoind chain clients
Due to the previous commit allowing us to specify the birthday of the
wallet at the time of the BitcoindClient's creation, this is now
unnecessary.
2018-07-30 17:54:08 -07:00
Olaoluwa Osuntokun
8b2629a935
Merge pull request #514 from vapopov/zerobalance
wallet: fix lost balance of unmined transaction for neutrino
2018-07-23 17:58:56 -07:00
Olaoluwa Osuntokun
dbb7ae6668 wallet: remove extraneous err check 2018-07-16 19:47:17 -07:00
Olaoluwa Osuntokun
fb511876c5 wallet: update to use new recovery manager API 2018-07-16 19:47:17 -07:00
Olaoluwa Osuntokun
49e46f3232 wallet: update rescan to take addrs along with their outpoints 2018-07-16 19:47:17 -07:00
Olaoluwa Osuntokun
d6ee9fd0e4 wallet: update HD recovery logic to map outpoints to addresses 2018-07-16 19:47:17 -07:00
Vadym Popov
40ba75dd9d
wallet: fix lost balance of unmined transaction for neutrino 2018-07-13 12:41:02 +03:00
Conner Fromknecht
78ea2cdc9c wallet/chainntfns: ensure safe shutdown during sync 2018-07-12 18:00:07 -07:00
Olaoluwa Osuntokun
b0b64d3bbd multi: update due to latest API changes 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
7770cac383 multi: switch import paths back to upstream 2018-05-23 19:38:56 -07:00
Conner Fromknecht
4c6b9053b8 wallet/wallet: adds recovery for default scopes 2018-05-23 19:38:56 -07:00
Conner Fromknecht
71ce1d5474 wallet/recovery_test: adds test for 1-in-1-out spend 2018-05-23 19:38:56 -07:00
Conner Fromknecht
e4124d8e8b wallet/recovery: adds wallet recovery manager 2018-05-23 19:38:56 -07:00
Conner Fromknecht
d26cf062fe wallet/loader: feed birthday+recovery window to wallet 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
620be5821f wallet: ensure PublishTransaction handles nil error case 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
fbfca5f4ae wallet: in PublishTransaction if tx is rejected, remove it from the txstore 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
921dae5d5e wallet: catch remaining bitcoind errors, and generic RPC errors resendUnminedTxs
In this commit, ensure that upon restart, if any of the full-node based
backends we support reject the transaction, then we'll properly remove
the now invalid transaction from the tx store. Before this commit, we
could miss a few errors from bitcoind. To remedy this, we explicitly
catch those errors, but then also attempt to precisely catch the set of
generic json RPC errors that can be returned.
2018-05-23 19:38:56 -07:00
Wilmer Paulino
8b2aebe89e wallet: add call to modify both public and private passphrases atomically 2018-05-23 19:38:56 -07:00
Kenneth Perry (thothonegan)
0547e5a313 When determining whether to rollback, ask the chain using the chainhash instead of the possibly invalid local hash 2018-05-23 19:38:56 -07:00
Alex
6d16463627 wallet: demote chainntfns error about out-of-sync blocks to debug 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
5eaecee2c9 wallet: ensure timestamp is always set when calling waddrmgr.SetSyncedTo 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
0dcd36bf59 wallet: only remove conflicting unmined transactions
In this commit, we fix a bug introduced in an earlier commit. Before
this commit, we would *always* remove an unmined transaction if it
failed to be accepted by the network upon restart. Instead, we should
only remove transaction that are actually due to us trying to spend an
output that’s already spent, or an orphan transaction.
2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
3b66af9154 wallet: properly set timestamp during block connect/disconnect 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
b75bf1426e wallet: update wallet to be aware of new KeyScopes 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
ab4ccacbb9 wallet: extend PublishTransaction to be a general reliable broadcaster
In this commit, we extend the PublishTransction method to be a more
general semi reliable transaction broadcast mechanism. We do this by
removing the special casing for neutrino. With this change, we’ll
_always_ write any transactions to be broadcast to disk. A side effect
of this, is that if the transaction doesn’t *directly* involve any
outputs we control, then it’ll linger around until a restart, when we
try to rebroadcast, and observe that it has bene rejected.
2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
54b31c1a35 wallet: remove conflicting double spend transactions on start up 2018-05-23 19:38:56 -07:00
Johan T. Halseth
8bcd56fc27 wallet/size test: add vsize test for non-segwit tx 2018-05-23 19:38:56 -07:00
Johan T. Halseth
d626036401 wallet/author: use vsize when estimating fees
This commit makes use of the recently added EstimateVirtualSize
method to estimated the size of a transaction when calculating
fees. This makes fee estimation more accurate when we are spending
segwit outputs, as before we wouldn't account for the witness
descount, resulting in overshooting fee estimates.
2018-05-23 19:38:56 -07:00
Johan T. Halseth
2caa8878b4 wallet/size test: add TestEstimateVirtualSize
This commit adds a test for EstimateVirtualSize. Currently three
test transactions are added:
    - 1 P2WPKH inputs + 2 P2PKH outputs
    - 1 P2SH-P2WPKH inputs + 2 P2PKH outputs
    - 1 P2WPKH inputs + 1 P2PKH output + 1 P2WPKH change output
2018-05-23 19:38:56 -07:00
Johan T. Halseth
f782f9dc68 wallet/size: add EstimateVirtualSize
This commit adds a new method EstimateVirtualSize that calculates
the worst case estimate vsize for a transaction with a given set
of inputs and outputs. This method is aware of P2PKH, P2WPKH and
P2SH-P2WPKH inputs, and caulculates the transaction vsize with
the witness data included.
2018-05-23 19:38:56 -07:00
Alex
73dbcf3943 multi: add bitcoind back-end (only for API use for now) 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
b963eb3ba4 wallet: pass in fee-per-kb into CreateSimpleTx 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
7b9d880fee wallet: remove internal relayFee in favor of passing in fee rate when sending
In this commit, we do away with the internal relayFee all together.
Instead, we’ll pass in the fee rate when we’re crafting any
transactions. This allows the caller to manually dictate their desired
fee rate.
2018-05-23 19:38:56 -07:00
Johan T. Halseth
255f23679f wallet: close db on Open() failure.
This commit makes sure the wallet db is closed if the call to
open the wallet fails, as subsequent calls to OpenExistingWallet
would fail to open the already open database.
2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
ee841b07cf wallet: for ineutrino back-end insert all broadcast transactions into txstore 2018-05-23 19:38:56 -07:00
Alex
5c69110f47 wallet: ensure rescan is launched with all addresses
During the time of initial block hash catch-up, it is possible to
request an address be generated. This commit updates the active
addresses by calling `w.activeData` after the catch-up is complete.
2018-05-23 19:38:56 -07:00
Alex
5113a64617 wallet: fix nil dereference in rescanprogress ntfn handler 2018-05-23 19:38:56 -07:00
Alex
8e2c741f88 wallet: move DB access from rescan ntfns into correct goroutine 2018-05-23 19:38:56 -07:00
Alex
81a9bb67c1 wallet: set wallet birthday properly in rescans and manager 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
a0abd3632c multi: update to new upstream btcsuite/btcd API's 2018-05-23 19:38:56 -07:00
Alex
58f303b957 wallet: make initial sync play nicer with neutrino+bdb backends 2018-05-23 19:38:56 -07:00
Alex
fbde9a97c8 wallet: eliminate some unneeded database transaction opens/commits 2018-05-23 19:38:56 -07:00
Alex
4fb78bca18 wallet: add logging when catching up block hashes on startup/rescan 2018-05-23 19:38:56 -07:00
Alex
3eb28d2d37 wallet: batch initial block hash catch-up process every 10K blocks 2018-05-23 19:38:56 -07:00
Alex Akselrod
c85893de1a chain+waddrmgr+wallet: store all hashes for better reorg handling (#5) 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
3567ae87f4 wallet: avoid double-writing block stamps in onFilteredBlockConnected 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
3dc7a8529c multi: switch all imports to roasbeef's forks 2018-05-23 19:38:56 -07:00