100 Commits
Author SHA1 Message Date
Tadge Dryja 71231c477c make imports lowercase 2016-04-30 20:24:57 -07:00
Tadge Dryja 2367300d71 Merge branch 'uspvdev' 2016-02-26 13:23:00 -08:00
Tadge Dryja 623d67234d was requesting an already known block, fixed that 2016-02-26 12:30:15 -08:00
Tadge Dryja d2d37ce1ab make it way faster
there were a lot of dumb things in Ingest() that made it really slow.
Like re-hashing the tx a bunch of times.  And re-saving it to the
db redundantly.

also added local bloom filters.  Maybe some concurrency issues if you
generate an address just as you're getting a tx with that address but
that doesn't seem like a real problem.  Cheap to rescan anyway.

So it's faster and works better.
2016-02-25 21:05:01 -08:00
Tadge Dryja 2c1f42d6fd fix block out of order error 2016-02-25 18:19:43 -08:00
Tadge Dryja caf56aaff0 db optimizations 2016-02-25 12:08:35 -08:00
Tadge Dryja f9a740d392 more stress testing stuff 2016-02-24 17:27:29 -08:00
Tadge Dryja df04a73e1a simplify boltdb ingest 2016-02-24 02:37:52 -08:00
Tadge Dryja a14b9a9e70 fix the boltdb problem
not that I know how I fixed it... just moved stuff around.
Oh, bolt.  Any time I see "})" I know I'm in bizzaro world.
2016-02-22 23:21:54 -08:00
Tadge Dryja dd1f2c00fe add fanout. fix boltdb weirdness.
again with keys / values within the bolttx acting weird.
it wasn't deleting utxos that had been spent by the ingested tx.
it'd do the first 30 then stop.  Deferred deletion and copied the
serialized utxo.  Not sure which of those fixed it.  Maybe both.
2016-02-22 16:32:58 -08:00
Tadge Dryja bc4cf5ba80 add per tx fee estimation
seems to work fine.  Can add monitoring of avg fees later
2016-02-22 14:35:01 -08:00
Tadge Dryja 2b808724fb spend from wpkh works 2016-02-22 01:41:40 -08:00
Tadge Dryja 57a34f0753 spending witness inputs still doesn't work... 2016-02-21 17:42:30 -08:00
Tadge Dryja cb3b20ad6c use WitnessSignatureScript 2016-02-21 14:28:47 -08:00
Tadge Dryja 05590279b2 deal with p2wsh? maybe..? 2016-02-21 13:49:04 -08:00
Tadge Dryja f6cf4b87f0 pretty ugly. But got the hash from the bip143 example. 2016-02-20 00:42:07 -08:00
Tadge Dryja 233ec9538c add testing sighash folder 2016-02-19 14:49:04 -08:00
Tadge Dryja d8e62f6898 back to one adr[] slice
all adrs can be converted on the fly and displayed both ways.
in the actual UI this shouldn't happen though.

Also utxos are sorted and signed properly.  utxo selection
is still pretty low tech.
2016-02-19 01:24:23 -08:00
Tadge Dryja fbd17846d4 split adrs up into two slices?
here is code to keep track of two sets of addresses -- the
regular ones and the witness ones.  But maybe those should be
merged becuase it's easy for other wallets to switch between them
and send to the same 20 byte pubkey hash but wintessified.
So maybe I'll change this stuff...
2016-02-19 00:32:22 -08:00
Tadge Dryja a175e098fa remove waitgroups from ingest block
It doesn't work; can ingest out of order within a block,
so if a block has gain then loss, you might read it as loss
then gains, missing the loss.
Also, tryna implement p2wpkh
2016-02-17 23:16:17 -08:00
Tadge Dryja 0d3639435f can sync with segnet in hard mode
lots of changes but they seem to work
2016-02-15 22:13:17 -08:00
Tadge Dryja a955a428a7 fix nil witness crash; sync's now on segnet 2016-02-14 12:50:20 -08:00
Tadge Dryja ee4dd8aaa0 trying to get witness coinbases to validate
(they don't)
2016-02-13 14:03:11 -08:00
Tadge Dryja 7fdcf9bfbc start trying to connect to segnet
doesn't work or anything yet
2016-02-10 13:22:15 -08:00
Tadge Dryja 2cbe605221 Merge branch 'master' of github.com:lightningnetwork/lnd into uspvdev 2016-02-08 14:09:35 -08:00
Tadge Dryja e2dd892a4f add waitgroups to ingestBlock
seems to go a little faster but not much.
making ingest tx take a slice of txs would be faster probably.
but it seems network i/o is the limiting factor so maybe it's OK
2016-02-07 19:52:45 -08:00
Tadge Dryja 4535b965cd implement hard mode
seems to work OK.  Could be sped up by local filters instead of
ingesting every tx from the block but I can do that later if
performance (mostly disk i/o) is an issue

once multiple connections are implemented, hard mode should forward
txs to blend in.
2016-02-06 22:48:54 -08:00
Tadge Dryja 8518be13f7 add hard mode test methods
really simple to check block merkle root
next can modify "ingestMerkleBlock" to ingest either type of block.
2016-02-06 19:15:35 -08:00
Tadge Dryja 63b5926e01 add getalltxs, dup checks
Start of double spend detection for mempool and reorgs
2016-02-05 01:59:40 -08:00
Tadge Dryja 25d90f5345 reorganize lots of files, add rebroadcast
move methods to new files to keep things a bit organized.
add rebroadcast of unconfirmed txs after sync
mutex on OKtxid map
deal with doublespends next
2016-02-05 01:16:45 -08:00
Tadge Dryja 9eccb0638a I think this fixes all sync problems
add a bool to the HashAndHeight struct;
can indicate "final".  When the block market final comes in,
we don't enter wait state, but instead ask for headers.
when you don't get any headers, you wont need any blocks, and that
will assert the wait state.
2016-02-03 20:26:12 -08:00
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
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
Tadge Dryja 3fecd67920 cycle sender / receiver to bytes and back 2016-01-18 23:28:14 -08:00
Tadge Dryja c1212d1369 off by 1 fix, a little more serdes check 2016-01-18 21:26:28 -08:00
Tadge Dryja 2b66c234c6 actually remove current from sender and calc on the fly for addnext 2016-01-18 21:08:16 -08:00
Tadge Dryja 2301af5615 remove "current" from receiver, add very simple serialization test 2016-01-18 21:04:53 -08:00
Tadge Dryja d4a31d4127 add initial unit test for elkrem send / receive 2016-01-18 20:43:02 -08:00
Tadge Dryja 6f8cf3d75a remove node serdes, pretty sure it's redundant 2016-01-18 20:17:15 -08:00
Tadge Dryja a3f65bb4ad serialization / deserialization of elkrem built, untested 2016-01-18 20:15:51 -08:00
Tadge Dryja fc5e58ad7d add serdes (start) for elkrem 2016-01-18 18:24:34 -08:00
Tadge Dryja 26d9ae7f2b add tcp dial bypass for pbx 2016-01-17 22:32:19 -08:00
Tadge Dryja 1f11e011de Merge pull request #3 from PaulCapestany/master
Make lnd go-gettable, add install instructions to readme
2016-01-17 20:59:13 -08:00
Tadge Dryja b0a402bc4f remove ID private key from LNDConn struct 2016-01-17 11:20:40 -08:00
Tadge Dryja 9e5f302288 move lnadr from main to lndc package 2016-01-17 10:45:07 -08:00
Tadge Dryja 85590e0f6c revert to testnet3 params 2016-01-16 11:11:43 -08:00
Tadge Dryja e03e21ba80 add parse from string 2016-01-16 11:09:12 -08:00
Tadge Dryja 04b83d024e rever to older netio 2016-01-16 11:07:20 -08:00
Tadge Dryja 8469b4fd9f name LNDConn back, put h160 back for now 2016-01-16 10:59:10 -08:00
Tadge Dryja f81f28c5fe Merge branch 'master' of github.com:lightningnetwork/lnd 2016-01-16 10:46:19 -08:00
Tadge Dryja 2815afebb7 update imports to github 2016-01-16 10:45:54 -08:00
Tadge Dryja d47105217b change imports to github.com/lightningnetwork/lnd 2016-01-16 10:38:48 -08:00
Tadge Dryja 5879dae7c0 tweak readme 2016-01-16 00:22:23 -08:00
Tadge Dryja f6fde399e1 add copyright, license and discouragement in readme 2016-01-16 00:13:11 -08:00
Tadge Dryja 34a958c6ef add / modify / merge to readme 2016-01-15 18:56:57 -08:00
Tadge Dryja c4d64372c8 update readme 2016-01-15 13:19:13 -08:00
Tadge Dryja 29a8e81029 spv sync works but more to add 2016-01-15 02:40:56 -08:00
Tadge Dryja e6970e132e spv header sync works OK 2016-01-14 23:58:05 -08:00
Tadge Dryja 6cebc7c952 remove odl filter file; in txstore now 2016-01-14 23:58:05 -08:00
Tadge Dryja 65c7d1c40c move elkrem, uspv libs to plasma repo 2016-01-14 23:58:05 -08:00
Tadge Dryja 58f0bfe252 plasma daemon can connect, receive connections, and send chat msgs. 2016-01-14 23:56:10 -08:00
Tadge Dryja 5bafdc4bc6 rpc client can tell plasma to listen, it can listen & auth 2016-01-14 23:56:09 -08:00
Tadge Dryja 919b0002b1 put MSGID bytes back in to lnwire 2016-01-14 23:56:09 -08:00
Tadge Dryja 19233dc42d wallet creation works, takes 11 seconds 2016-01-14 23:56:09 -08:00
Tadge Dryja 726ba629f5 ok now it works. Sortof. Still hangs, but hangs later, after writing pkh. 2016-01-14 23:56:09 -08:00