mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-31 17:51:33 +02:00
lnwallet: add a String() method to WitnessType
This commit is contained in:
committed by
Joost Jager
parent
3b1357c3ab
commit
3fd03b2f4a
@@ -71,6 +71,44 @@ const (
|
|||||||
HtlcSecondLevelRevoke WitnessType = 9
|
HtlcSecondLevelRevoke WitnessType = 9
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Stirng returns a human readable version of the target WitnessType.
|
||||||
|
func (wt WitnessType) String() string {
|
||||||
|
switch wt {
|
||||||
|
case CommitmentTimeLock:
|
||||||
|
return "CommitmentTimeLock"
|
||||||
|
|
||||||
|
case CommitmentNoDelay:
|
||||||
|
return "CommitmentNoDelay"
|
||||||
|
|
||||||
|
case CommitmentRevoke:
|
||||||
|
return "CommitmentRevoke"
|
||||||
|
|
||||||
|
case HtlcOfferedRevoke:
|
||||||
|
return "HtlcOfferedRevoke"
|
||||||
|
|
||||||
|
case HtlcAcceptedRevoke:
|
||||||
|
return "HtlcAcceptedRevoke"
|
||||||
|
|
||||||
|
case HtlcOfferedTimeoutSecondLevel:
|
||||||
|
return "HtlcOfferedTimeoutSecondLevel"
|
||||||
|
|
||||||
|
case HtlcAcceptedSuccessSecondLevel:
|
||||||
|
return "HtlcAcceptedSuccessSecondLevel"
|
||||||
|
|
||||||
|
case HtlcOfferedRemoteTimeout:
|
||||||
|
return "HtlcOfferedRemoteTimeout"
|
||||||
|
|
||||||
|
case HtlcAcceptedRemoteSuccess:
|
||||||
|
return "HtlcAcceptedRemoteSuccess"
|
||||||
|
|
||||||
|
case HtlcSecondLevelRevoke:
|
||||||
|
return "HtlcSecondLevelRevoke"
|
||||||
|
|
||||||
|
default:
|
||||||
|
return fmt.Sprintf("Unknown WitnessType: %v", uint32(wt))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// WitnessGenerator represents a function which is able to generate the final
|
// WitnessGenerator represents a function which is able to generate the final
|
||||||
// witness for a particular public key script. This function acts as an
|
// witness for a particular public key script. This function acts as an
|
||||||
// abstraction layer, hiding the details of the underlying script.
|
// abstraction layer, hiding the details of the underlying script.
|
||||||
|
Reference in New Issue
Block a user