Rusty Russell
b836b452dc
feerate: keep feerates separately for each side.
When we support changing them, they can be different during the transition.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Christian Decker
d1cc5f4552
wallet: Add unit tests for payment persistence
Signed-off-by: Christian Decker <decker.christian@gmail.com>
7 years ago
Rusty Russell
f71a18241a
wallet: save and restore htlc_basepoint for remote side.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
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>
7 years ago
Rusty Russell
7133a2f9b3
wallet: assume db errors will be fatal, don't check.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
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>
7 years ago
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>
7 years ago
Rusty Russell
48cedef756
peer_control: remove unique_id field.
It's now completely useless.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Christian Decker
a005bce155
wallet: Adding primitives to save/load invoices to wallet
Signed-off-by: Christian Decker <decker.christian@gmail.com>
7 years ago
Christian Decker
b4732f6091
wallet_tests: Testing the rewiring of loaded htlcs
Signed-off-by: Christian Decker <decker.christian@gmail.com>
7 years ago
Christian Decker
e162a53e86
wallet_tests: Enable logging in the unit tests
Signed-off-by: Christian Decker <decker.christian@gmail.com>
7 years ago
Christian Decker
eb5ed961ed
wallet: Added loading of HTLCs from the database
Signed-off-by: Christian Decker <decker.christian@gmail.com>
7 years ago
Christian Decker
b8fa765c3f
wallet: Add primitives to store htlcs in the database
Signed-off-by: Christian Decker <decker.christian@gmail.com>
7 years ago
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.
7 years ago
Rusty Russell
1ffb9f07c1
ccan: update to latest shachain.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
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>
7 years ago
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>
7 years ago
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>
7 years ago
Christian Decker
1ac10716be
wallet: Add closing parameters to channel state
I must have missed these before, so adding them now.
7 years ago
Christian Decker
1070bbccde
wallet: Add channel_config persistence to channel persistence
Signed-off-by: Christian Decker <decker.christian@gmail.com>
8 years ago
Christian Decker
f2382884b6
wallet: Add roundtrip test for channel_config persistence
Signed-off-by: Christian Decker <decker.christian@gmail.com>
8 years ago
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.
8 years ago
Christian Decker
8b7efd01d7
wallet: Created a simple persisted shachain unit-test
This exercises the create, read and update functionality of the
persisted shachain.
8 years ago
Christian Decker
bdb6b1002f
wallet: Reserve UTXOs used in build_utxos
8 years ago
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.
8 years ago