Commit Graph

11420 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
77d37298f4 chainntfns: close all pending client channels on shutdown for BtcdNotifier 2016-02-26 17:38:31 -08:00
Olaoluwa Osuntokun
3186b3038c chainntfns: document the ChainNotifier interface 2016-02-26 17:38:31 -08:00
Olaoluwa Osuntokun
1944003fde lnwallet: update to use new btcdnotify.NewBtcdNotifier API 2016-02-26 17:38:31 -08:00
Olaoluwa Osuntokun
8ce8c29af6 chainntfns: add basic tests for confirmation+spending notifications
* The tests as written will be general to all future implementations of
ChainNotifier allowing future implementers to easily ensure their
implementation meets the expected behavior.

* The tests will be moved to the outer directory once a registration
mechanism for notifier implementations is in place.
2016-02-26 17:38:31 -08:00
Olaoluwa Osuntokun
19e1b64f2c chainntfs: use an int32 for NegativeConf 2016-02-26 17:38:31 -08:00
Olaoluwa Osuntokun
e92fc5f495 chainntfs: switch BtcdNotifier to directly use btcrpcclient
* Turns out the NotificationServer on btcwallet doesn’t sever full
blocks, nor notify for arbitrary transactions. Instead, we now create a
new client specifically for BtcdNotifier.

* Final implementation is simpler, less dependent on newer btcwallet
features in flux. Additionally, this decouples the chain notifications
from the wallet. Enabling reliance on btcd for notifications, in
conjunction with an independent wallet that satisfies the to-be-drafted
Wallet interface.
2016-02-26 17:38:31 -08:00
Olaoluwa Osuntokun
1c59dfc75c chainntfs: fix the Pop method on confirmationHeap 2016-02-26 17:38:31 -08:00
Olaoluwa Osuntokun
25c1b7a491 lnwallet: update chainNotifier assignment to new BtcdNotifier constructor 2016-02-26 17:38:31 -08:00
Olaoluwa Osuntokun
3d478cdd3e chainntfs: use btcwallet's new NotificationServer for BtcdNotifier
* Rather than rely on the legacy notification interface which may be
deprecated in the near future, we’ll now switch to using the
NotificationSever.

* Negative confirmation notifications due to re-orgs are still
unimplemented however.
2016-02-26 17:38:30 -08:00
Olaoluwa Osuntokun
9fb8045bd2 chainntfns: remove source.go it's no longer needed 2016-02-26 17:38:30 -08:00
Olaoluwa Osuntokun
c7402f3462 chainntfns: update BtcdNotifier to adhere to new ChainNotifier interface
* Re-orgs are still unhanded.

* RegisterSpendNtfn should perhaps also register directly with the rpc
client instead of pushing the responsibility to the caller.
2016-02-26 17:38:30 -08:00
Olaoluwa Osuntokun
b913bda472 chainntfs: expand ChainNotifier interface
* The `NotificationTrigger` struct has been dropped. Instead we know
simply employ a non-blocking send over a chan struct. This moves the
responsibility of triggering callbacks a level above to the registering
client.

* Confirmation notifications also now have a counter part in order to
notify a caller of the scenario wherein a funding transaction drops out
of the chain due to a re-org. A “neagtiveConf” value will be sent to
the client over a channel in this case. This will allow a caller to
re-register for another confirmation notification. Note that due to
this scenario, callers should also register for notifications
concerning spends of the counterparty’s inputs to the funding
transaction. If a second spend (other than the funding) is detected,
the channel should be closed immediately.

* Notifications concerning spends now also include the spending
transaction, hash, and the input on the spending transaction at which
the outpoint is spent.
2016-02-26 17:38:30 -08: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
Joseph Poon
e940e92823 Updated wire to use int64 2016-02-18 04:29:08 -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
Olaoluwa Osuntokun
ab16933575 lnwallet: commit tx should have final sequence num 2016-02-05 20:24:32 -08:00
Olaoluwa Osuntokun
81a4887d11 lnwallet: move lockTimeToSequence to script_utils.go 2016-02-05 20:24:17 -08:00
Olaoluwa Osuntokun
fa05ee9a22 lnwallet: move pubKey comparison for funding output spend into spendMultiSig func
* This change makes the spendMultiSig function testable independent of
the reservation workflow.
2016-02-05 12:33:22 -08:00
Olaoluwa Osuntokun
4632894562 lnwallet: move teardown of rpctest before setup to ensure proper cleanup
* Previously, if the call to SetUp(..) returned an error, then the test
harness would fail to stop the running bcd process, and clean up the
test directories. This would cause any subsequent tests to fail. This
commit remedies this scenario.
2016-02-05 12:32:23 -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
Olaoluwa Osuntokun
d1ec44c16d remove lnwallet unlock in lnd.go it's handled in NewLightningWallet 2016-02-03 16:35:17 -08:00