Commit graph

150 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
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 fb511876c5 wallet: update to use new recovery manager API 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 4c6b9053b8 wallet/wallet: adds recovery for default scopes 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
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 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
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
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 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 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
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 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 ef179b1e18 wallet: fix final compile error 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
Olaoluwa Osuntokun 02b0f7d51c wallet: update to new btcrpcclient API 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun f13a081e31 wallet: add public method to expose the database 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun 77b756c651 multi: point all imports towards roasbeef's forks 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun d88739df8f wallet: add address type param to NewChangeAddress+NewAddress 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun a2ff118b25 wallet: fix compile errors under WIP segwit branch 2018-05-23 19:38:56 -07:00
Josh Rickmar 3e598f0f7b Fix reported spendable balances from coinbase outputs. (#467)
Previously, this would not increment the spendable balance for matured
coinbase outputs and would only increment the immature balance if the
output was still immature.
2017-01-10 13:02:03 -05:00
Josh Rickmar 1cb3b8b29a Update project dependencies. (#456)
This updates both btcsuite and external dependencies to their latest
versions.  In particular, gRPC was updated to version 1.0.3 and bolt
to 1.3.0.

The walletrpc package needed to be regenerated for the gRPC update.

While here, update the Travis-CI script so this can be tested there.
2016-10-27 12:27:58 -04:00
Dave Collins d76627e6d5 Update for recent chaincfg API changes. (#451)
Since the coinbase maturity is now allowed to be defined per chain and
the old blockchain.CoinbaseMaturity constant has been removed, this
updates the code accordingly.

Also, update glide.lock to use the required version of btcd.
2016-08-12 19:27:51 -05:00
Dave Collins e92f94dcd1 Update for recent chainhash-related API changes. (#450)
This updates all code to make use of the new chainhash package since the
old wire.ShaHash type and related functions have been removed in favor
of the abstracted package.

Also, while here, rename all variables that included sha in their name
to include hash instead.

Finally, update glide.lock to use the required version of btcd, btcutil,
and btcrpcclient.
2016-08-08 14:49:09 -05:00
George Melika eefc610904 Check for missing txs before dereferencing details 2016-04-06 16:24:46 -04:00
Josh Rickmar fcccae3d1a Manage wallet db namespaces from wallet package.
This changes the wallet.Open function signature to remove the database
namespace parameters.  This is done so that the wallet package itself
is responsible for the location and opening of these namespaces from
the database, rather than requiring the caller to open these ahead of
time.

A new wallet.Create function has also been added.  This function
initializes a new wallet in an empty database, using the same
namespaces as wallet.Open will eventually use.  This relieves the
caller from needing to manage wallet database namespaces explicitly.

Fixes #397.
2016-03-21 11:25:28 -04:00
Josh Rickmar 71649abefe improve language 2016-03-11 17:01:04 -05:00
Josh Rickmar 6e6cb307fa Log wallet locks and unlocks.
Fixes #392.
2016-03-11 16:22:43 -05:00
Josh Rickmar 6cf22b7944 Remove legacy JSON-RPC notifications.
These notifications were added to support real time updates for
btcgui.  As the btcgui project is no longer being developed, there are
no more consumers of this API, and it makes sense to remove them given
their various issues (the largest being that notifiations are sent
unsubscribed to clients that may never be interrested in them).

A new notification server has already been added to the wallet package
to handle notifications in a RPC-server agnostic way.  This server is
the means by which the wallet notifies changes for gRPC clients.  If
per-client registered notifications are to be re-added for the
JSON-RPC server, they should be integrated with the new notification
server rather than using this legacy code.
2016-03-11 14:14:33 -05:00
Josh Rickmar 24fc8bb6c5 Read synchronized relay fee once when checking outputs. 2016-03-09 15:03:42 -05:00
Josh Rickmar d09c2a84c1 Protect the relay fee field with a mutex.
This prevents races when setting a new relay fee through the legacy
RPC server (settxfee).

Fixes #379.
2016-03-09 14:54:09 -05:00