utxonursery: finish migrating to lnwire OutPoint serialization

This commit is contained in:
Philip Hayes 2017-05-07 04:43:55 -07:00 committed by Olaoluwa Osuntokun
parent b19c483a04
commit 56793a1041
3 changed files with 19 additions and 10 deletions

@ -612,11 +612,18 @@ func (b *breachArbiter) exactRetribution(confChan *chainntnfs.ConfirmationEvent,
revokedFunds, totalFunds)
// With the channel closed, mark it in the database as such.
err := b.db.MarkChanFullyClosed(&breachInfo.chanPoint)
err := b.db.MarkChanFullyClosed(&ret.chanPoint)
if err != nil {
brarLog.Errorf("unable to mark chan as closed: %v", err)
}
// Justice has been carried out; we can safely delete the retribution
// info from the database.
err = b.retributionStore.Remove(&ret.chanPoint)
if err != nil {
brarLog.Errorf("unable to remove retribution from the db: %v", err)
}
// TODO(roasbeef): add peer to blacklist?
// TODO(roasbeef): close other active channels with offending peer

@ -441,7 +441,7 @@ func (u *utxoNursery) NurseryReport(chanPoint *wire.OutPoint) (*contractMaturity
}
var b bytes.Buffer
if err := writeOutpoint(&b, chanPoint); err != nil {
if err := lnwire.WriteOutPoint(&b, chanPoint); err != nil {
return err
}
chanPointBytes := b.Bytes()
@ -563,7 +563,7 @@ func (k *kidOutput) enterPreschool(db *channeldb.DB) error {
// track all the immature outpoints for a particular channel's
// chanPoint.
var b bytes.Buffer
err = writeOutpoint(&b, &k.originChanPoint)
err = lnwire.WriteOutPoint(&b, &k.originChanPoint)
if err != nil {
return err
}
@ -604,7 +604,7 @@ func (k *kidOutput) waitForPromotion(db *channeldb.DB, confChan *chainntnfs.Conf
// array form prior to database insertion.
err := db.Update(func(tx *bolt.Tx) error {
var originPoint bytes.Buffer
if err := writeOutpoint(&originPoint, &k.originChanPoint); err != nil {
if err := lnwire.WriteOutPoint(&originPoint, &k.originChanPoint); err != nil {
return err
}
@ -916,7 +916,7 @@ func deleteGraduatedOutputs(db *channeldb.DB, deleteHeight uint32) error {
}
for _, sweptOutput := range sweptOutputs {
var chanPoint bytes.Buffer
err := writeOutpoint(&chanPoint, &sweptOutput.originChanPoint)
err := lnwire.WriteOutPoint(&chanPoint, &sweptOutput.originChanPoint)
if err != nil {
return err
}
@ -993,7 +993,7 @@ func serializeKidOutput(w io.Writer, kid *kidOutput) error {
if err := lnwire.WriteOutPoint(w, &kid.outPoint); err != nil {
return err
}
if err := writeOutpoint(w, &kid.originChanPoint); err != nil {
if err := lnwire.WriteOutPoint(w, &kid.originChanPoint); err != nil {
return err
}
@ -1051,7 +1051,9 @@ func deserializeKidOutput(r io.Reader) (*kidOutput, error) {
if err != nil {
return nil, err
}
if err := readOutpoint(io.LimitReader(r, 40), &kid.originChanPoint); err != nil {
err = lnwire.ReadOutPoint(io.LimitReader(r, 40), &kid.originChanPoint)
if err != nil {
return nil, err
}

@ -171,7 +171,7 @@ var (
amt: btcutil.Amount(13e7),
outPoint: outPoints[0],
blocksToMaturity: uint32(100),
witnessType: commitmentTimeLock,
witnessType: lnwallet.CommitmentTimeLock,
confHeight: uint32(1770001),
},
@ -180,7 +180,7 @@ var (
amt: btcutil.Amount(24e7),
outPoint: outPoints[1],
blocksToMaturity: uint32(50),
witnessType: commitmentTimeLock,
witnessType: lnwallet.CommitmentTimeLock,
confHeight: uint32(22342321),
},
@ -189,7 +189,7 @@ var (
amt: btcutil.Amount(2e5),
outPoint: outPoints[2],
blocksToMaturity: uint32(12),
witnessType: commitmentTimeLock,
witnessType: lnwallet.CommitmentTimeLock,
confHeight: uint32(34241),
},
}