lnwallet+input: fix a few typoes

This commit is contained in:
zhiqiangxu
2024-03-19 17:05:03 +08:00
parent 0a29b37be6
commit 74a290b46d
4 changed files with 25 additions and 24 deletions

View File

@@ -376,7 +376,7 @@ func SenderHTLCScript(senderHtlcKey, receiverHtlcKey,
// We'll drop the OP_IF return value off the top of the stack so we can // We'll drop the OP_IF return value off the top of the stack so we can
// reconstruct the multi-sig script used as an off-chain covenant. If // reconstruct the multi-sig script used as an off-chain covenant. If
// two valid signatures are provided, ten then output will be deemed as // two valid signatures are provided, then the output will be deemed as
// spendable. // spendable.
builder.AddOp(txscript.OP_DROP) builder.AddOp(txscript.OP_DROP)
builder.AddOp(txscript.OP_2) builder.AddOp(txscript.OP_2)
@@ -391,8 +391,9 @@ func SenderHTLCScript(senderHtlcKey, receiverHtlcKey,
// Hash the top item of the stack and compare it with the hash160 of // Hash the top item of the stack and compare it with the hash160 of
// the payment hash, which is already the sha256 of the payment // the payment hash, which is already the sha256 of the payment
// pre-image. By using this little trick we're able save space on-chain // pre-image. By using this little trick we're able to save space
// as the witness includes a 20-byte hash rather than a 32-byte hash. // on-chain as the witness includes a 20-byte hash rather than a
// 32-byte hash.
builder.AddOp(txscript.OP_HASH160) builder.AddOp(txscript.OP_HASH160)
builder.AddData(Ripemd160H(paymentHash)) builder.AddData(Ripemd160H(paymentHash))
builder.AddOp(txscript.OP_EQUALVERIFY) builder.AddOp(txscript.OP_EQUALVERIFY)
@@ -2009,7 +2010,7 @@ func LockTimeToSequence(isSeconds bool, locktime uint32) uint32 {
// <revokeKey> // <revokeKey>
// OP_ELSE // OP_ELSE
// <numRelativeBlocks> OP_CHECKSEQUENCEVERIFY OP_DROP // <numRelativeBlocks> OP_CHECKSEQUENCEVERIFY OP_DROP
// <timeKey> // <selfKey>
// OP_ENDIF // OP_ENDIF
// OP_CHECKSIG // OP_CHECKSIG
func CommitScriptToSelf(csvTimeout uint32, selfKey, revokeKey *btcec.PublicKey) ([]byte, error) { func CommitScriptToSelf(csvTimeout uint32, selfKey, revokeKey *btcec.PublicKey) ([]byte, error) {
@@ -2358,7 +2359,7 @@ func TaprootCommitSpendRevoke(signer Signer, signDesc *SignDescriptor,
// OP_ELSE // OP_ELSE
// <absoluteLeaseExpiry> OP_CHECKLOCKTIMEVERIFY OP_DROP // <absoluteLeaseExpiry> OP_CHECKLOCKTIMEVERIFY OP_DROP
// <numRelativeBlocks> OP_CHECKSEQUENCEVERIFY OP_DROP // <numRelativeBlocks> OP_CHECKSEQUENCEVERIFY OP_DROP
// <timeKey> // <selfKey>
// OP_ENDIF // OP_ENDIF
// OP_CHECKSIG // OP_CHECKSIG
func LeaseCommitScriptToSelf(selfKey, revokeKey *btcec.PublicKey, func LeaseCommitScriptToSelf(selfKey, revokeKey *btcec.PublicKey,
@@ -2961,7 +2962,7 @@ func CommitSpendAnchorAnyone(script []byte) (wire.TxWitness, error) {
// SingleTweakBytes computes set of bytes we call the single tweak. The purpose // SingleTweakBytes computes set of bytes we call the single tweak. The purpose
// of the single tweak is to randomize all regular delay and payment base // of the single tweak is to randomize all regular delay and payment base
// points. To do this, we generate a hash that binds the commitment point to // points. To do this, we generate a hash that binds the commitment point to
// the pay/delay base point. The end end results is that the basePoint is // the pay/delay base point. The end result is that the basePoint is
// tweaked as follows: // tweaked as follows:
// //
// - key = basePoint + sha256(commitPoint || basePoint)*G // - key = basePoint + sha256(commitPoint || basePoint)*G

View File

@@ -200,14 +200,14 @@ const (
Add updateType = iota Add updateType = iota
// Fail is an update type which removes a prior HTLC entry from the // Fail is an update type which removes a prior HTLC entry from the
// log. Adding a Fail entry to ones log will modify the _remote_ // log. Adding a Fail entry to one's log will modify the _remote_
// parties update log once a new commitment view has been evaluated // party's update log once a new commitment view has been evaluated
// which contains the Fail entry. // which contains the Fail entry.
Fail Fail
// MalformedFail is an update type which removes a prior HTLC entry // MalformedFail is an update type which removes a prior HTLC entry
// from the log. Adding a MalformedFail entry to ones log will modify // from the log. Adding a MalformedFail entry to one's log will modify
// the _remote_ parties update log once a new commitment view has been // the _remote_ party's update log once a new commitment view has been
// evaluated which contains the MalformedFail entry. The difference // evaluated which contains the MalformedFail entry. The difference
// from Fail type lie in the different data we have to store. // from Fail type lie in the different data we have to store.
MalformedFail MalformedFail
@@ -401,7 +401,7 @@ type PaymentDescriptor struct {
// PayDescsFromRemoteLogUpdates converts a slice of LogUpdates received from the // PayDescsFromRemoteLogUpdates converts a slice of LogUpdates received from the
// remote peer into PaymentDescriptors to inform a link's forwarding decisions. // remote peer into PaymentDescriptors to inform a link's forwarding decisions.
// //
// NOTE: The provided `logUpdates` MUST corresponding exactly to either the Adds // NOTE: The provided `logUpdates` MUST correspond exactly to either the Adds
// or SettleFails in this channel's forwarding package at `height`. // or SettleFails in this channel's forwarding package at `height`.
func PayDescsFromRemoteLogUpdates(chanID lnwire.ShortChannelID, height uint64, func PayDescsFromRemoteLogUpdates(chanID lnwire.ShortChannelID, height uint64,
logUpdates []channeldb.LogUpdate) ([]*PaymentDescriptor, error) { logUpdates []channeldb.LogUpdate) ([]*PaymentDescriptor, error) {
@@ -514,9 +514,9 @@ type commitment struct {
ourMessageIndex uint64 ourMessageIndex uint64
theirMessageIndex uint64 theirMessageIndex uint64
// [our|their]HtlcIndex are the current running counters for the HTLC's // [our|their]HtlcIndex are the current running counters for the HTLCs
// offered by either party. This value is incremented each time a party // offered by either party. This value is incremented each time a party
// offers a new HTLC. The log update methods that consume HTLC's will // offers a new HTLC. The log update methods that consume HTLCs will
// reference these counters, rather than the running cumulative message // reference these counters, rather than the running cumulative message
// counters. // counters.
ourHtlcIndex uint64 ourHtlcIndex uint64
@@ -580,7 +580,7 @@ type commitment struct {
// locateOutputIndex is a small helper function to locate the output index of a // locateOutputIndex is a small helper function to locate the output index of a
// particular HTLC within the current commitment transaction. The duplicate map // particular HTLC within the current commitment transaction. The duplicate map
// massed in is to be retained for each output within the commitment // massed in is to be retained for each output within the commitment
// transition. This ensures that we don't assign multiple HTLC's to the same // transition. This ensures that we don't assign multiple HTLCs to the same
// index within the commitment transaction. // index within the commitment transaction.
func locateOutputIndex(p *PaymentDescriptor, tx *wire.MsgTx, ourCommit bool, func locateOutputIndex(p *PaymentDescriptor, tx *wire.MsgTx, ourCommit bool,
dups map[PaymentHash][]int32, cltvs []uint32) (int32, error) { dups map[PaymentHash][]int32, cltvs []uint32) (int32, error) {
@@ -595,7 +595,7 @@ func locateOutputIndex(p *PaymentDescriptor, tx *wire.MsgTx, ourCommit bool,
return false return false
} }
// If this their commitment transaction, we'll be trying to locate // If this is their commitment transaction, we'll be trying to locate
// their pkScripts, otherwise we'll be looking for ours. This is // their pkScripts, otherwise we'll be looking for ours. This is
// required as the commitment states are asymmetric in order to ascribe // required as the commitment states are asymmetric in order to ascribe
// blame in the case of a contract breach. // blame in the case of a contract breach.
@@ -628,7 +628,7 @@ func locateOutputIndex(p *PaymentDescriptor, tx *wire.MsgTx, ourCommit bool,
"cltv=%v", pkScript, p.Amount, p.Timeout) "cltv=%v", pkScript, p.Amount, p.Timeout)
} }
// populateHtlcIndexes modifies the set of HTLC's locked-into the target view // populateHtlcIndexes modifies the set of HTLCs locked-into the target view
// to have full indexing information populated. This information is required as // to have full indexing information populated. This information is required as
// we need to keep track of the indexes of each HTLC in order to properly write // we need to keep track of the indexes of each HTLC in order to properly write
// the current state to disk, and also to locate the PaymentDescriptor // the current state to disk, and also to locate the PaymentDescriptor
@@ -637,7 +637,7 @@ func (c *commitment) populateHtlcIndexes(chanType channeldb.ChannelType,
cltvs []uint32) error { cltvs []uint32) error {
// First, we'll set up some state to allow us to locate the output // First, we'll set up some state to allow us to locate the output
// index of the all the HTLC's within the commitment transaction. We // index of the all the HTLCs within the commitment transaction. We
// must keep this index so we can validate the HTLC signatures sent to // must keep this index so we can validate the HTLC signatures sent to
// us. // us.
dups := make(map[PaymentHash][]int32) dups := make(map[PaymentHash][]int32)
@@ -799,7 +799,7 @@ func (c *commitment) toDiskCommit(ourCommit bool) *channeldb.ChannelCommitment {
// diskHtlcToPayDesc converts an HTLC previously written to disk within a // diskHtlcToPayDesc converts an HTLC previously written to disk within a
// commitment state to the form required to manipulate in memory within the // commitment state to the form required to manipulate in memory within the
// commitment struct and updateLog. This function is used when we need to // commitment struct and updateLog. This function is used when we need to
// restore commitment state written do disk back into memory once we need to // restore commitment state written to disk back into memory once we need to
// restart a channel session. // restart a channel session.
func (lc *LightningChannel) diskHtlcToPayDesc(feeRate chainfee.SatPerKWeight, func (lc *LightningChannel) diskHtlcToPayDesc(feeRate chainfee.SatPerKWeight,
commitHeight uint64, htlc *channeldb.HTLC, localCommitKeys, commitHeight uint64, htlc *channeldb.HTLC, localCommitKeys,
@@ -816,7 +816,7 @@ func (lc *LightningChannel) diskHtlcToPayDesc(feeRate chainfee.SatPerKWeight,
chanType = lc.channelState.ChanType chanType = lc.channelState.ChanType
) )
// If the either outputs is dust from the local or remote node's // If the either output is dust from the local or remote node's
// perspective, then we don't need to generate the scripts as we only // perspective, then we don't need to generate the scripts as we only
// generate them in order to locate the outputs within the commitment // generate them in order to locate the outputs within the commitment
// transaction. As we'll mark dust with a special output index in the // transaction. As we'll mark dust with a special output index in the
@@ -1259,8 +1259,8 @@ func compactLogs(ourLog, theirLog *updateLog,
// //
// The state machine has for main methods: // The state machine has for main methods:
// - .SignNextCommitment() // - .SignNextCommitment()
// - Called one one wishes to sign the next commitment, either initiating a // - Called once when one wishes to sign the next commitment, either
// new state update, or responding to a received commitment. // initiating a new state update, or responding to a received commitment.
// - .ReceiveNewCommitment() // - .ReceiveNewCommitment()
// - Called upon receipt of a new commitment from the remote party. If the // - Called upon receipt of a new commitment from the remote party. If the
// new commitment is valid, then a revocation should immediately be // new commitment is valid, then a revocation should immediately be
@@ -2919,7 +2919,7 @@ func createBreachRetributionLegacy(revokedLog *channeldb.ChannelCommitment,
// HtlcIsDust determines if an HTLC output is dust or not depending on two // HtlcIsDust determines if an HTLC output is dust or not depending on two
// bits: if the HTLC is incoming and if the HTLC will be placed on our // bits: if the HTLC is incoming and if the HTLC will be placed on our
// commitment transaction, or theirs. These two pieces of information are // commitment transaction, or theirs. These two pieces of information are
// require as we currently used second-level HTLC transactions as off-chain // required as we currently used second-level HTLC transactions as off-chain
// covenants. Depending on the two bits, we'll either be using a timeout or // covenants. Depending on the two bits, we'll either be using a timeout or
// success transaction which have different weights. // success transaction which have different weights.
func HtlcIsDust(chanType channeldb.ChannelType, func HtlcIsDust(chanType channeldb.ChannelType,

View File

@@ -1021,7 +1021,7 @@ func genSegwitV0HtlcScript(chanType channeldb.ChannelType,
// being applied to their commitment transaction or ours. // being applied to their commitment transaction or ours.
switch { switch {
// The HTLC is paying to us, and being applied to our commitment // The HTLC is paying to us, and being applied to our commitment
// transaction. So we need to use the receiver's version of HTLC the // transaction. So we need to use the receiver's version of the HTLC
// script. // script.
case isIncoming && ourCommit: case isIncoming && ourCommit:
witnessScript, err = input.ReceiverHTLCScript( witnessScript, err = input.ReceiverHTLCScript(

View File

@@ -15,7 +15,7 @@ const OnionPacketSize = 1366
// HTLC to his remote commitment transaction. In addition to information // HTLC to his remote commitment transaction. In addition to information
// detailing the value, the ID, expiry, and the onion blob is also included // detailing the value, the ID, expiry, and the onion blob is also included
// which allows Bob to derive the next hop in the route. The HTLC added by this // which allows Bob to derive the next hop in the route. The HTLC added by this
// message is to be added to the remote node's "pending" HTLC's. A subsequent // message is to be added to the remote node's "pending" HTLCs. A subsequent
// CommitSig message will move the pending HTLC to the newly created commitment // CommitSig message will move the pending HTLC to the newly created commitment
// transaction, marking them as "staged". // transaction, marking them as "staged".
type UpdateAddHTLC struct { type UpdateAddHTLC struct {