wallet: Set shutdown keyindex to -1 if not set

Was using unsigned ints before, which is just plain wrong.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
Christian Decker 2017-08-19 16:14:18 +02:00 committed by Rusty Russell
parent c0aefad8e3
commit 50ee067393

View file

@ -499,7 +499,7 @@ static bool wallet_stmt2channel(struct wallet *w, sqlite3_stmt *stmt,
chan->peer->local_shutdown_idx = sqlite3_column_int64(stmt, col++); chan->peer->local_shutdown_idx = sqlite3_column_int64(stmt, col++);
} else { } else {
chan->peer->remote_shutdown_scriptpubkey = tal_free(chan->peer->remote_shutdown_scriptpubkey); chan->peer->remote_shutdown_scriptpubkey = tal_free(chan->peer->remote_shutdown_scriptpubkey);
chan->peer->local_shutdown_idx = 0; chan->peer->local_shutdown_idx = -1;
col += 2; col += 2;
} }
@ -691,7 +691,7 @@ bool wallet_channel_save(struct wallet *w, struct wallet_channel *chan){
" push_msatoshi=%"PRIu64"," " push_msatoshi=%"PRIu64","
" msatoshi_local=%s," " msatoshi_local=%s,"
" shutdown_scriptpubkey_remote='%s'," " shutdown_scriptpubkey_remote='%s',"
" shutdown_keyidx_local=%"PRIu64"," " shutdown_keyidx_local=%"PRId64","
" channel_config_local=%"PRIu64"," " channel_config_local=%"PRIu64","
" last_tx=%s, last_sig=%s" " last_tx=%s, last_sig=%s"
" WHERE id=%"PRIu64, " WHERE id=%"PRIu64,