lnwallet: csv delay is a uint32, fill forgotten fields in channel state

This commit is contained in:
Olaoluwa Osuntokun 2015-12-26 00:07:30 -06:00
parent b4e33587b1
commit 890ceecc1a
2 changed files with 8 additions and 6 deletions

View File

@ -94,7 +94,7 @@ func (lc *LightningChannel) VerifyCommitmentUpdate() error {
// createCommitTx...
func createCommitTx(fundingOutput *wire.TxIn, ourKey, theirKey *btcec.PublicKey,
revokeHash [wire.HashSize]byte, csvTimeout int64, channelAmt btcutil.Amount) (*wire.MsgTx, error) {
revokeHash [wire.HashSize]byte, csvTimeout uint32, channelAmt btcutil.Amount) (*wire.MsgTx, error) {
// First, we create the script paying to us. This script is spendable
// under two conditions: either the 'csvTimeout' has passed and we can
@ -112,7 +112,7 @@ func createCommitTx(fundingOutput *wire.TxIn, ourKey, theirKey *btcec.PublicKey,
// Otherwise, we can re-claim our funds after a CSV delay of
// 'csvTimeout' timeout blocks, and a valid signature.
scriptToUs.AddInt64(csvTimeout)
scriptToUs.AddInt64(int64(csvTimeout))
scriptToUs.AddOp(txscript.OP_NOP3) // CSV
scriptToUs.AddOp(txscript.OP_DROP)
scriptToUs.AddData(ourKey.SerializeCompressed())

View File

@ -38,7 +38,7 @@ type ChannelContribution struct {
// The delay (in blocks) to be used for the pay-to-self output in this
// party's version of the commitment transaction.
CsvDelay int64
CsvDelay uint32
}
// ChannelReservation...
@ -51,7 +51,7 @@ type ChannelReservation struct {
// For CLTV it is nLockTime, for CSV it's nSequence, for segwit it's
// not needed
fundingLockTime int64
fundingLockTime uint32
// In order of sorted inputs. Sorting is done in accordance
// to BIP-69: https://github.com/bitcoin/bips/blob/master/bip-0069.mediawiki.
@ -92,8 +92,10 @@ func newChannelReservation(t FundingType, fundingAmt btcutil.Amount,
},
partialState: &OpenChannelState{
// TODO(roasbeef): assumes balanced symmetric channels.
Capacity: fundingAmt * 2,
MinFeePerKb: minFeeRate,
Capacity: fundingAmt * 2,
OurBalance: fundingAmt,
TheirBalance: fundingAmt,
MinFeePerKb: minFeeRate,
},
reservationID: id,
wallet: wallet,