Rusty Russell
4fb472b7a7
db: we must always be in a transaction, remove nested, call fatal()
...
We save location where transaction was started, in case we try to nest.
There's now no error case; db_exec_mayfail() is the only one.
This means the tests need to override fatal() if they want to intercept
these errors.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-11-06 10:24:34 +01:00
Rusty Russell
7133a2f9b3
wallet: assume db errors will be fatal, don't check.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-11-06 10:24:34 +01:00
Rusty Russell
3282768302
wallet: don't fail, assume db ops will call fatal.
...
And override fatal() in wallet_tests to be sure.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-11-06 10:24:34 +01:00
Christian Decker
da183c22a0
db: Cleanup all remaining traces of hex-encoded values
...
In addition we also set some of the test values to a pattern instead
of just `memset`ting it to 0, which may hide some crossed lines.
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2017-10-31 22:43:47 +00:00
Rusty Russell
48cedef756
peer_control: remove unique_id field.
...
It's now completely useless.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-10-24 16:12:22 +02:00
Christian Decker
a005bce155
wallet: Adding primitives to save/load invoices to wallet
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2017-10-09 11:51:13 +10:30
Christian Decker
b4732f6091
wallet_tests: Testing the rewiring of loaded htlcs
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2017-10-09 11:51:13 +10:30
Christian Decker
e162a53e86
wallet_tests: Enable logging in the unit tests
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2017-10-09 11:51:13 +10:30
Christian Decker
eb5ed961ed
wallet: Added loading of HTLCs from the database
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2017-10-09 11:51:13 +10:30
Christian Decker
b8fa765c3f
wallet: Add primitives to store htlcs in the database
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2017-10-09 11:51:13 +10:30
Christian Decker
4bc0750882
wallet: Moving wallet_channel->peer_id into the peer struct
...
This was supposed to be a temporary solution anyway, and I had a
rather annoying mixup between peer_id and unique_id, the latter of
which is actually a connection identifier.
2017-08-23 10:23:54 +09:30
Rusty Russell
1ffb9f07c1
ccan: update to latest shachain.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-08-20 13:06:41 +09:30
Rusty Russell
893335244d
openingd: supply initial tx as well as signature.
...
And store in peer->last_tx/peer->last_sig like all other places,
that way we broadcast it if we need to.
Note: the removal of tmpctx in funder_channel() is needed because we
use txs[0], which was allocated off tmpctx.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-08-20 13:06:41 +09:30
Rusty Russell
c389215a35
closingd: send the tx to master as we negotiate.
...
We can derive fees from this, and also broadcast at any time without
having to reconstruct it.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-08-20 13:06:41 +09:30
Rusty Russell
dbfac68c3f
lightningd: keep last valid tx, and its signature.
...
This avoids us having to reconstruct it.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-08-20 13:06:41 +09:30
Christian Decker
1ac10716be
wallet: Add closing parameters to channel state
...
I must have missed these before, so adding them now.
2017-08-10 12:34:58 +09:30
Christian Decker
1070bbccde
wallet: Add channel_config persistence to channel persistence
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2017-08-10 12:34:58 +09:30
Christian Decker
f2382884b6
wallet: Add roundtrip test for channel_config persistence
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2017-08-10 12:34:58 +09:30
Christian Decker
6f441d3cd2
wallet: Add a CRU(D) test for wallet_channels
...
Simple roundtrip testing which writes to DB, reads it back in and
checks for equality.
2017-08-10 12:34:58 +09:30
Christian Decker
8b7efd01d7
wallet: Created a simple persisted shachain unit-test
...
This exercises the create, read and update functionality of the
persisted shachain.
2017-08-10 12:34:58 +09:30
Christian Decker
bdb6b1002f
wallet: Reserve UTXOs used in build_utxos
2017-06-06 09:16:10 +09:30
Christian Decker
5396335363
wallet: Add wallet_tests and simplify db_tests
...
I'll eventually move the utils into a different location (maybe CCAN?)
but for now I'm keeping it close to where it is used.
2017-06-06 09:16:10 +09:30