Commit graph

196 commits

Author SHA1 Message Date
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
Alex 3f12fa3c6c chain+wallet: rename SPVChain to NeutrinoClient 2018-05-23 19:38:56 -07:00
Alex b5873a5b2c Finish integration of Neutrino; still untested. 2018-05-23 19:38:56 -07:00
Alex 9e5250e6d7 More neutrino integration into btcwallet. 2018-05-23 19:38:56 -07:00
Alex 32adc3c43f Make rescan a struct, add spending tx to GetUtxo, start integration. 2018-05-23 19:38:56 -07:00
Alex e273e178dd Repoint repo to btcsuite on btcwalletln, and a few rebase fixes. 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun d27d1211c5 wallet: fix db deadlock when creating new tx 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun ef179b1e18 wallet: fix final compile error 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun 4ce4a70968 wallet+votingpool: direct import paths to roasbeef 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun 14e6fe36d0 wallet: remove sync.go, references decred 2018-05-23 19:38:56 -07:00
Josh Rickmar bf86ccf5b4 calculate each account's balance individually 2018-05-23 19:38:56 -07:00
Josh Rickmar 4656a00705 Improve wallet atomicity.
This changes the database access APIs and each of the "manager"
packages (waddrmgr/wstakemgr) so that transactions are opened (only)
by the wallet package and the namespace buckets that each manager
expects to operate on are passed in as parameters.

This helps improve the atomicity situation as it means that many
calls to these APIs can be grouped together into a single
database transaction.

This change does not attempt to completely fix the "half-processed"
block problem.  Mined transactions are still added to the wallet
database under their own database transaction as this is how they are
notified by the consensus JSON-RPC server (as loose transactions,
without the rest of the block that contains them). It will make
updating to a fixed notification model significantly easier, as the
same "manager" APIs can still be used, but grouped into a single
atomic transaction.
2018-05-23 19:38:56 -07:00