utxonursery: remove unused report fields

This commit is contained in:
Joost Jager 2019-01-07 10:05:30 +01:00
parent 9abe06f3c8
commit 288fc6f065
No known key found for this signature in database
GPG Key ID: A61B9D4C393C59C7

@ -494,9 +494,7 @@ func (u *utxoNursery) NurseryReport(
utxnLog.Infof("NurseryReport: building nursery report for channel %v", utxnLog.Infof("NurseryReport: building nursery report for channel %v",
chanPoint) chanPoint)
report := &contractMaturityReport{ report := &contractMaturityReport{}
chanPoint: *chanPoint,
}
if err := u.cfg.Store.ForChanOutputs(chanPoint, func(k, v []byte) error { if err := u.cfg.Store.ForChanOutputs(chanPoint, func(k, v []byte) error {
switch { switch {
@ -1051,10 +1049,6 @@ func (u *utxoNursery) waitForPreschoolConf(kid *kidOutput,
// contractMaturityReport is a report that details the maturity progress of a // contractMaturityReport is a report that details the maturity progress of a
// particular force closed contract. // particular force closed contract.
type contractMaturityReport struct { type contractMaturityReport struct {
// chanPoint is the channel point of the original contract that is now
// awaiting maturity within the utxoNursery.
chanPoint wire.OutPoint
// limboBalance is the total number of frozen coins within this // limboBalance is the total number of frozen coins within this
// contract. // contract.
limboBalance btcutil.Amount limboBalance btcutil.Amount
@ -1063,16 +1057,6 @@ type contractMaturityReport struct {
// back to the user's wallet. // back to the user's wallet.
recoveredBalance btcutil.Amount recoveredBalance btcutil.Amount
// localAmount is the local value of the commitment output.
localAmount btcutil.Amount
// confHeight is the block height that this output originally confirmed.
confHeight uint32
// maturityRequirement is the input age required for this output to
// reach maturity.
maturityRequirement uint32
// maturityHeight is the absolute block height that this output will // maturityHeight is the absolute block height that this output will
// mature at. // mature at.
maturityHeight uint32 maturityHeight uint32
@ -1090,13 +1074,6 @@ type htlcMaturityReport struct {
// amount is the final value that will be swept in back to the wallet. // amount is the final value that will be swept in back to the wallet.
amount btcutil.Amount amount btcutil.Amount
// confHeight is the block height that this output originally confirmed.
confHeight uint32
// maturityRequirement is the input age required for this output to
// reach maturity.
maturityRequirement uint32
// maturityHeight is the absolute block height that this output will // maturityHeight is the absolute block height that this output will
// mature at. // mature at.
maturityHeight uint32 maturityHeight uint32
@ -1113,10 +1090,6 @@ type htlcMaturityReport struct {
func (c *contractMaturityReport) AddLimboCommitment(kid *kidOutput) { func (c *contractMaturityReport) AddLimboCommitment(kid *kidOutput) {
c.limboBalance += kid.Amount() c.limboBalance += kid.Amount()
c.localAmount += kid.Amount()
c.confHeight = kid.ConfHeight()
c.maturityRequirement = kid.BlocksToMaturity()
// If the confirmation height is set, then this means the contract has // If the confirmation height is set, then this means the contract has
// been confirmed, and we know the final maturity height. // been confirmed, and we know the final maturity height.
if kid.ConfHeight() != 0 { if kid.ConfHeight() != 0 {
@ -1129,9 +1102,6 @@ func (c *contractMaturityReport) AddLimboCommitment(kid *kidOutput) {
func (c *contractMaturityReport) AddRecoveredCommitment(kid *kidOutput) { func (c *contractMaturityReport) AddRecoveredCommitment(kid *kidOutput) {
c.recoveredBalance += kid.Amount() c.recoveredBalance += kid.Amount()
c.localAmount += kid.Amount()
c.confHeight = kid.ConfHeight()
c.maturityRequirement = kid.BlocksToMaturity()
c.maturityHeight = kid.BlocksToMaturity() + kid.ConfHeight() c.maturityHeight = kid.BlocksToMaturity() + kid.ConfHeight()
} }
@ -1144,7 +1114,6 @@ func (c *contractMaturityReport) AddLimboStage1TimeoutHtlc(baby *babyOutput) {
c.htlcs = append(c.htlcs, htlcMaturityReport{ c.htlcs = append(c.htlcs, htlcMaturityReport{
outpoint: *baby.OutPoint(), outpoint: *baby.OutPoint(),
amount: baby.Amount(), amount: baby.Amount(),
confHeight: baby.ConfHeight(),
maturityHeight: baby.expiry, maturityHeight: baby.expiry,
stage: 1, stage: 1,
}) })
@ -1159,7 +1128,6 @@ func (c *contractMaturityReport) AddLimboDirectHtlc(kid *kidOutput) {
htlcReport := htlcMaturityReport{ htlcReport := htlcMaturityReport{
outpoint: *kid.OutPoint(), outpoint: *kid.OutPoint(),
amount: kid.Amount(), amount: kid.Amount(),
confHeight: kid.ConfHeight(),
maturityHeight: kid.absoluteMaturity, maturityHeight: kid.absoluteMaturity,
stage: 2, stage: 2,
} }
@ -1174,11 +1142,9 @@ func (c *contractMaturityReport) AddLimboStage1SuccessHtlc(kid *kidOutput) {
c.limboBalance += kid.Amount() c.limboBalance += kid.Amount()
c.htlcs = append(c.htlcs, htlcMaturityReport{ c.htlcs = append(c.htlcs, htlcMaturityReport{
outpoint: *kid.OutPoint(), outpoint: *kid.OutPoint(),
amount: kid.Amount(), amount: kid.Amount(),
confHeight: kid.ConfHeight(), stage: 1,
maturityRequirement: kid.BlocksToMaturity(),
stage: 1,
}) })
} }
@ -1188,11 +1154,9 @@ func (c *contractMaturityReport) AddLimboStage2Htlc(kid *kidOutput) {
c.limboBalance += kid.Amount() c.limboBalance += kid.Amount()
htlcReport := htlcMaturityReport{ htlcReport := htlcMaturityReport{
outpoint: *kid.OutPoint(), outpoint: *kid.OutPoint(),
amount: kid.Amount(), amount: kid.Amount(),
confHeight: kid.ConfHeight(), stage: 2,
maturityRequirement: kid.BlocksToMaturity(),
stage: 2,
} }
// If the confirmation height is set, then this means the first stage // If the confirmation height is set, then this means the first stage
@ -1211,11 +1175,9 @@ func (c *contractMaturityReport) AddRecoveredHtlc(kid *kidOutput) {
c.recoveredBalance += kid.Amount() c.recoveredBalance += kid.Amount()
c.htlcs = append(c.htlcs, htlcMaturityReport{ c.htlcs = append(c.htlcs, htlcMaturityReport{
outpoint: *kid.OutPoint(), outpoint: *kid.OutPoint(),
amount: kid.Amount(), amount: kid.Amount(),
confHeight: kid.ConfHeight(), maturityHeight: kid.ConfHeight() + kid.BlocksToMaturity(),
maturityRequirement: kid.BlocksToMaturity(),
maturityHeight: kid.ConfHeight() + kid.BlocksToMaturity(),
}) })
} }