utxonursery: finish migrating to lnwire OutPoint serialization
This commit is contained in:
parent
b19c483a04
commit
56793a1041
@ -612,11 +612,18 @@ func (b *breachArbiter) exactRetribution(confChan *chainntnfs.ConfirmationEvent,
|
|||||||
revokedFunds, totalFunds)
|
revokedFunds, totalFunds)
|
||||||
|
|
||||||
// With the channel closed, mark it in the database as such.
|
// 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 {
|
if err != nil {
|
||||||
brarLog.Errorf("unable to mark chan as closed: %v", err)
|
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): add peer to blacklist?
|
||||||
|
|
||||||
// TODO(roasbeef): close other active channels with offending peer
|
// 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
|
var b bytes.Buffer
|
||||||
if err := writeOutpoint(&b, chanPoint); err != nil {
|
if err := lnwire.WriteOutPoint(&b, chanPoint); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
chanPointBytes := b.Bytes()
|
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
|
// track all the immature outpoints for a particular channel's
|
||||||
// chanPoint.
|
// chanPoint.
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
err = writeOutpoint(&b, &k.originChanPoint)
|
err = lnwire.WriteOutPoint(&b, &k.originChanPoint)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -604,7 +604,7 @@ func (k *kidOutput) waitForPromotion(db *channeldb.DB, confChan *chainntnfs.Conf
|
|||||||
// array form prior to database insertion.
|
// array form prior to database insertion.
|
||||||
err := db.Update(func(tx *bolt.Tx) error {
|
err := db.Update(func(tx *bolt.Tx) error {
|
||||||
var originPoint bytes.Buffer
|
var originPoint bytes.Buffer
|
||||||
if err := writeOutpoint(&originPoint, &k.originChanPoint); err != nil {
|
if err := lnwire.WriteOutPoint(&originPoint, &k.originChanPoint); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -916,7 +916,7 @@ func deleteGraduatedOutputs(db *channeldb.DB, deleteHeight uint32) error {
|
|||||||
}
|
}
|
||||||
for _, sweptOutput := range sweptOutputs {
|
for _, sweptOutput := range sweptOutputs {
|
||||||
var chanPoint bytes.Buffer
|
var chanPoint bytes.Buffer
|
||||||
err := writeOutpoint(&chanPoint, &sweptOutput.originChanPoint)
|
err := lnwire.WriteOutPoint(&chanPoint, &sweptOutput.originChanPoint)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -993,7 +993,7 @@ func serializeKidOutput(w io.Writer, kid *kidOutput) error {
|
|||||||
if err := lnwire.WriteOutPoint(w, &kid.outPoint); err != nil {
|
if err := lnwire.WriteOutPoint(w, &kid.outPoint); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := writeOutpoint(w, &kid.originChanPoint); err != nil {
|
if err := lnwire.WriteOutPoint(w, &kid.originChanPoint); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1051,7 +1051,9 @@ func deserializeKidOutput(r io.Reader) (*kidOutput, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ var (
|
|||||||
amt: btcutil.Amount(13e7),
|
amt: btcutil.Amount(13e7),
|
||||||
outPoint: outPoints[0],
|
outPoint: outPoints[0],
|
||||||
blocksToMaturity: uint32(100),
|
blocksToMaturity: uint32(100),
|
||||||
witnessType: commitmentTimeLock,
|
witnessType: lnwallet.CommitmentTimeLock,
|
||||||
confHeight: uint32(1770001),
|
confHeight: uint32(1770001),
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ var (
|
|||||||
amt: btcutil.Amount(24e7),
|
amt: btcutil.Amount(24e7),
|
||||||
outPoint: outPoints[1],
|
outPoint: outPoints[1],
|
||||||
blocksToMaturity: uint32(50),
|
blocksToMaturity: uint32(50),
|
||||||
witnessType: commitmentTimeLock,
|
witnessType: lnwallet.CommitmentTimeLock,
|
||||||
confHeight: uint32(22342321),
|
confHeight: uint32(22342321),
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ var (
|
|||||||
amt: btcutil.Amount(2e5),
|
amt: btcutil.Amount(2e5),
|
||||||
outPoint: outPoints[2],
|
outPoint: outPoints[2],
|
||||||
blocksToMaturity: uint32(12),
|
blocksToMaturity: uint32(12),
|
||||||
witnessType: commitmentTimeLock,
|
witnessType: lnwallet.CommitmentTimeLock,
|
||||||
confHeight: uint32(34241),
|
confHeight: uint32(34241),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user