Commit graph

964 commits

Author SHA1 Message Date
Alex
6a1cb8c846 Working cfilter download (slows down tests). 2018-05-23 19:38:56 -07:00
Alex
125d47b55c Starting CFilter download work. 2018-05-23 19:38:56 -07:00
Alex
dd3e47756b A little cleanup. 2018-05-23 19:38:56 -07:00
Alex
5002268321 cfheaders sync works! 2018-05-23 19:38:56 -07:00
Alex
b42c527b1c Fixed some bugs. Still more to fix! 2018-05-23 19:38:56 -07:00
Alex
2b352c966d More debugging/fixes, still not working. 2018-05-23 19:38:56 -07:00
Alex
0bede37c79 More thorough testing. Tests still fail. 2018-05-23 19:38:56 -07:00
Alex
be44a3ea88 Fix some issues with cfheaders sync; reorgs still don't work. 2018-05-23 19:38:56 -07:00
Alex
87759a142f CFHeaders sync mostly done but still has some bugs. 2018-05-23 19:38:56 -07:00
Alex
4d82af7f8e Optimize, prepare for eventual sendheaders use, add sanity check 2018-05-23 19:38:56 -07:00
Alex
0a8de495cc Fix reorgs, improve string formatting/errors/logging. 2018-05-23 19:38:56 -07:00
Alex
f2aceaf363 Fix more test bugs. One last reorg bug to fix before moving on. 2018-05-23 19:38:56 -07:00
Alex
738d889e3d Possible sync fix - tests pass, but more to do 2018-05-23 19:38:56 -07:00
Alex
b7c5bcbf45 More updates on checkpoint, reorg, and sync handling and tests. 2018-05-23 19:38:56 -07:00
Alex
6ea7e6035d Reset chain to previous checkpoint if a checkpoint check fails 2018-05-23 19:38:56 -07:00
Alex
28b7bb65ea Fix checkpoint bug 2018-05-23 19:38:56 -07:00
Alex
68e02afbf4 SPV implementation - hodgepodge mishmash not done yet 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
28469c0315 waddrmgr: fix some missed compile errors 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
2bb45752e1 fix wtxmgr tests
While making these tests compile and pass, we ended up tripping on the
broken bolt cursor usage painfully discovered in dcrwallet, so i've
ported that fix over as well.  Would have learned about that a whole
lot sooner if those tests were never disabled..
2018-05-23 19:38:56 -07:00
Josh Rickmar
4e58d61556 i'm still laughing at how idiotic golint is about this 2018-05-23 19:38:56 -07:00
Josh Rickmar
e344c374e1 refactor walletdb driver tests into walletdbtest pkg and fix for api changes. 2018-05-23 19:38:56 -07:00
Josh Rickmar
44f1272f87 fix db cleanup 2018-05-23 19:38:56 -07:00
Josh Rickmar
1075ad3fa0 make votingpool tests compile and pass 2018-05-23 19:38:56 -07:00
Josh Rickmar
f143d095d6 Make votingpool package (sans tests) compile 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
521b2123de Fix RPC ping/pong deadlock and timeout issue.
This is a backport of decred/dcrwallet#612.

This change moves the wait for the session RPC response (used as a
pong) to a new goroutine that does not run directly in the queue
handler.  By moving this out to a new goroutine, the handler can
continue enqueuing and dequeueing notifications while waiting for the
session response.  Previously, if a notifiation was sent after the
session RPC was called and before the response was received, the
rpcclient main loop would block due to being unable to enqueue the
notification.
2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
01d52770d2 chain: enable auto-reconnect within the client 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
80f6e96025 fix imports 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
d2812d23f9 fix merge failure 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
2fb155724f rpc/legacy: update to latest btcrpcclient API 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
Andrey Samokhvalov
a978bfec8e add Pycharm .idea to .gitignore 2018-05-23 19:38:56 -07:00
Andrey Samokhvalov
5785ca17cc txrules: add threshold function in order to reuse it in lnd 2018-05-23 19:38:56 -07:00
Josh Rickmar
504b045332 Fix credit slice indexing for transaction notifications.
Previously, this would always check a transaction output index against
the 0th credit's index.
2018-05-23 19:38:56 -07:00
Josh Rickmar
61e96a69e4 Cleanup TransactionDetails RPC messages.
Remove the addresses field from TransactionDetails.Output.  It is
assumed that the caller is able to deserialize the transaction and
encode the output scripts to addresses, so this is unnecessary server
overhead and conflicts with the current API philosophy of not
duplicating data already included in another field.

Since there is no additional data included for outputs not controlled
by the wallet, remove the `mine` specifier from the Output message and
replace it with an output index.  Only include messages for controlled
outputs, rather than creating messages for both controlled and
uncontrolled outputs.  Rename the repeated field from `outputs` to
`credits` to be consistent with the `debits` field.

Bump major API version as this is a breaking change.

Closes #408.
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
422c0d6c93 rpc: update address generation to new API 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
1b19a78b48 waddrmgr: properly convert imported addresses 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
6dfc793ad3 wallet: use intermediate hash cache during validateMsgTx 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
7cb1b47140 wtxmgr: when creating a TxRecord don't compute txid manually
This fixes a bug introduced by the new segwit behavior upstream in
btcd. Previously it was a nice optimization to skip the extra
serialization, and compute the txid manually from the serialized
transaction.

However, with segwit, doing that will generate an invalid txid, since
txid’s should ignore any witness data. Therefore, we now fallback to
using msgTx.TxSha() which serializes the transaction without witness
data before calculating the txid.
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
beb3231a03 wallet/txauthor: add ability to sign for nested+normal p2wkh
This commit enabled the wallet to properly spend nested and normal
p2wkh outputs under its control.

For regular p2wkh outputs, spending simply involves presenting the
original pub key, and signature as the witness data.

For nested p2wkh outputs, in addition to the above, the version zero
witness p2wkh witness program is placed in the sigScript in order to
allow clients who are aware of BIP 16 to validate the witness spend.
2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
3d464a0bbc wallet: include input values during utxo selection and tx validation
When spending a segwit output, the wallet also needs the input value of
the previous output script. Therefore when selecting outputs the input
value is now returned. Additionally when validating newly signed
outputs the input value as also passed into `txscript.Engine`
2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
cb225e2add waddrmgr: add support for nested+regular witness key hash addresses
This commit introduces two new address types to the waddrmgr. The first
address type is the native p2wkh (pay-to-witness-key-hash) output type
introduced as part of BIP0141 and the segwit soft-fork. The second
address type is a p2wkh output nested *within* a regular p2sh output.
This second address allows older wallets which are not yet aware of the
new segwit output types to transparently pay to a wallet which does
support them. Additionally, using this nested p2wkh output the wallet
gains both the space+transaction fee savings, as well as the
malleability fixes.

Both address types have been implemented as special cases of the
ManagedPubKeyAddress since they share several traits, only
differentiating in the signing mechanism needed, and the concrete
implementation of btcutil.Address returned by the address.

Two new `addressType` constants have been added to waddrmgr’s db in
order to properly serialize and deserialize the new address types.
2018-05-23 19:38:56 -07:00