Commit Graph

5373 Commits

Author SHA1 Message Date
Tadge Dryja
27def9b623 Merge branch 'master' of github.com:lightningnetwork/lnd 2016-02-03 16:47:56 -08:00
Tadge Dryja
f67e7ba53e fix gopass dependency change 2016-02-03 16:47:29 -08:00
Olaoluwa Osuntokun
d1ec44c16d remove lnwallet unlock in lnd.go it's handled in NewLightningWallet 2016-02-03 16:35:17 -08:00
Olaoluwa Osuntokun
1a8ae48807 lnwallet: point rpctest at my in-progress fork+branch
Fixes compilation issues for those not using my laptop :)
2016-02-03 12:05:53 -08:00
Olaoluwa Osuntokun
daeecd5fc0 lnwallet: nuke most of setup.go, no longer needed w/ wallet.Loader 2016-02-03 12:01:45 -08:00
Olaoluwa Osuntokun
b3cdc6167f lnwallet: switch over to using btcwallet's new Loader type
Allows us to remove a lot of duplicated code pertaining to wallet
setup. We also gain hooks into the wallet to trigger callbacks once the
wallet is created/opened.
2016-02-03 12:01:45 -08:00
Olaoluwa Osuntokun
92c14c99c3 lnwallet: update tests to utilize the in-progress btcsuite/btcd/rpctest package
Instead of creating “fake” utxos for bob, and alice. We now employ a
dedicated mining node to hand out utxos, and generate blocks with hand
picked transactions.
2016-02-03 12:01:44 -08:00
Olaoluwa Osuntokun
7bebefbd8f lnwallet: fix script bug, ensure sigScript is set before verification 2016-02-03 12:01:44 -08:00
Olaoluwa Osuntokun
74ee5334f4 lnwallet: allow configurable net param for wallet create/open 2016-02-03 12:01:44 -08:00
Olaoluwa Osuntokun
98bbd314a7 lnwallet: add active Bitcoin network to config 2016-02-03 12:01:44 -08:00
Olaoluwa Osuntokun
80ce49a883 lnwallet: update btcwallet and chain.Client to new upstream API's
A major change for btcwallet adding a new RPC wallet, refactoring parts
of the wallet, and introducing new functionality has been introduced.
This commit updates lnwallet to the API changes. A future commit will
change lnwallet to use some of the new functionality such as the
notification server, etc.
2016-02-03 12:01:44 -08:00
Olaoluwa Osuntokun
034cbef66d lnwallet: avoid goroutines waiting for channel open indefinitely blocking
Select over the quit channel in order to shutdown goroutines waiting
for funding txn confirmations. Without this we may leak goroutines
which are blocked forever if the process isn’t exiting when the walet
is signaled to shutdown.
2016-02-03 12:01:44 -08:00
Olaoluwa Osuntokun
20d471a766 lnwalelt: add note for balance update ntfs 2016-02-03 12:01:44 -08:00
Olaoluwa Osuntokun
d96cf0ec64 lnwallet: fix receiver htlc script
* Fixes a bug in script_utils.go. CSV instead of CLTV was being used
  within the timeout clause of the receivers HTLC (sender can reclaim
the HTLC).
2016-02-03 12:01:44 -08:00
Olaoluwa Osuntokun
0ce4fb1294 lnwallet: properly set transaction version on commit txs 2016-02-03 12:01:44 -08:00
Tadge Dryja
10bcaeccc8 Merge branch 'uspvdev'
Conflicts:
	uspv/txstore.go
2016-02-03 00:16:27 -08:00
Tadge Dryja
624e776987 add shell spv testing mode
To try uspv, do ./lnd -spv
The remote node is hardcoded in shell.go.  If you aren't
running a full node on localhost, specify where to connect to.
Nearby nodes will be much faster but random testnet nodes on the
internet should also work.
2016-02-02 23:37:29 -08:00
Tadge Dryja
d4f7fd4504 Merge branch 'master' into elkremdev 2016-02-02 20:46:38 -08:00
Tadge Dryja
2f9fc87636 fix sync, remove sum from TxStore
Synchronization now seems to work well even with the rapid fire
many inv-block messages that I'm seeing often on testnet3.  I'm
not 100% sure measuring the len() of a buffered channel is safe
but it seems to work fine.
Got rid of 'sum' in the TxStore; can be computed from GetAllUtxos()
Might want to merge SCon and TxStore since there's not much going
on in TxStore any more...
2016-02-02 19:04:03 -08:00
Tadge Dryja
a9cf239ec3 fix readme, better state machine for sync 2016-02-02 17:14:13 -08:00
Tadge Dryja
4513d77216 add readme documentation 2016-02-02 02:19:26 -08:00
Tadge Dryja
ead7108b98 add findpre and docs about nLockTime hints 2016-02-02 01:18:59 -08:00
Tadge Dryja
e56b1993fc move ser/des from utxodb to txstore 2016-02-01 19:03:01 -08:00
Tadge Dryja
f231113b90 some cleanup, store spent txs
pretty much everything is db based now.  Still some concurrency issues
when multiple block inv messages come in (which they do) where
we used len(mBlockQueue) as a check for being synched up, which doesn't
quite work.  Find a better way to do that...
2016-01-31 15:02:38 -08:00
Tadge Dryja
cf01e02d64 fix dumb loop break error
break was outside the if bytes.Equal {}, oops.  only checked first output.
Works now.  Concurrency also seems OK but need to test more.
2016-01-31 02:08:39 -08:00
Tadge Dryja
3b774ef361 move tx ingest to all db, fixes sync
Sync was non-deterministic because ingest was concurrent.
Now receiving tx messages is blocking, but that's OK, they really need
to be in the right order because the whole point of bitcoin is to put
txs in the right order.  SendTx still has a problem that the change address
may not be recognized by ingest.
2016-01-31 01:05:31 -08:00
Tadge Dryja
83dff432b1 mutex helps, still some sequence errors from mblocks
Seems that merkle blocks can return txs out of sequence, unlike
regular blocks which have to be in temporal/sequential order.
so maybe want to absorb ALL txs from mblock, then expel all?
2016-01-29 00:48:14 -08:00
Tadge Dryja
4cd9087f9f problems with concurrent disk access (header file)
maybe add mutexes or something
2016-01-29 00:40:52 -08:00
Tadge Dryja
5c2bbff3eb fix more sync problems. Seems to work OK
One edge case is with long chains of unconfirmed txs.
All self-signed txs are stored, but not used to negate false incoming utxos yet.
2016-01-28 22:31:05 -08:00
Tadge Dryja
6ef9dc3d4a not saying it works, but it works better
redo how db and header sync works, somewhat simpler but a little
recursve-ish.  There is still an off by 1 error somewhere with headers.
2016-01-28 19:35:49 -08:00
Tadge Dryja
d9afd623eb new stxo struct and more db methods
I'm getting away from having both in-ram and on-disk stores for the transaction store data.
it should all be on disk, it's safer that way.  It might be slower but this will not
process many txs / second anyway.
2016-01-27 01:24:16 -08:00
Tadge Dryja
851d3533e5 deals with incoming blocks and txs
gets stuck on reorgs though, until program is restarted
2016-01-22 17:15:56 -08:00
Tadge Dryja
5a7c04bdb5 incoming invs and tx signing
when we get inv messages, txs are easy but blocks are a little tricky
block heigh synchronization is done via os' file system
signing is a bit inelegant (searches through inputs for pkscript matches)
but fast enough in practice
2016-01-22 16:04:27 -08:00
Tadge Dryja
01c35e62ab check for already known txs (due to reorg?) 2016-01-22 01:41:08 -08:00
Tadge Dryja
fbc424492d update filters as txs come in; missed some before 2016-01-21 21:50:42 -08:00
Tadge Dryja
fc100921e8 add pushtx, and outpoint comparitor 2016-01-21 17:59:50 -08:00
Tadge Dryja
9215c18113 keep track of addresses, check incoming txs for full pkscript match 2016-01-21 01:04:45 -08:00
Tadge Dryja
b7a2c46ea6 remove storage of pkscript; don't need it. 2016-01-20 22:57:05 -08:00
Tadge Dryja
278971936f pass network parameters as function arg 2016-01-20 21:27:58 -08:00
Tadge Dryja
73bbb29026 add keyfileio to manage private key storage on disk 2016-01-20 21:08:05 -08:00
Tadge Dryja
1f40c7214e good enough storage of spent txs 2016-01-20 01:23:47 -08:00
Tadge Dryja
29d0c0cc6f fix bolt slices. db read / write works.
also switch heights from uint32 to int32, which I guess is what they use.
Makes this thing last 2 billion blocks shorter.  If we get past uint32 time.
2016-01-19 23:40:04 -08:00
Tadge Dryja
0b5daa9b2b add utxodb for on disk storage of transactions. 2016-01-19 20:02:18 -08:00
Tadge Dryja
58c8d32ac5 add a height channel to keep track of incoming merkleblocks 2016-01-19 14:23:18 -08:00
Tadge Dryja
ece5dc9d2d add txtostring 2016-01-19 11:59:01 -08:00
Tadge Dryja
709b8a05cd oh right, another fun thing I forgot about
When there's only the coinbase tx, the merkle root = the coinbase txid.
Needless complication in bitcoin == job security?
2016-01-19 10:59:13 -08:00
Tadge Dryja
7dbf4a4a4f update uspv, add function for height from header
still a bunch of problems getting utxo sets
2016-01-19 01:33:58 -08:00
Tadge Dryja
24afe237db Merge branch 'master' into uspvdev 2016-01-19 00:31:09 -08:00
Tadge Dryja
dd2c2274c8 export fields from lnid and add deserialization method 2016-01-19 00:05:02 -08:00
Tadge Dryja
229e34b326 make SPVCon version agnostic 2016-01-18 23:43:41 -08:00