diff --git a/types/transaction.go b/types/transaction.go index 2dc1a47..6652d3b 100644 --- a/types/transaction.go +++ b/types/transaction.go @@ -202,6 +202,31 @@ type TxInputZC struct { // InputType returns the wire variant tag for ZC inputs. func (t TxInputZC) InputType() uint8 { return InputTypeZC } +// TxInputHTLC extends TxInputToKey with an HTLC origin hash (HF1+). +// Wire order: HTLCOrigin (string) serialised BEFORE parent fields (C++ quirk). +// Carries Amount, KeyOffsets, KeyImage, EtcDetails -- same as TxInputToKey. +type TxInputHTLC struct { + HTLCOrigin string // C++ field: hltc_origin (transposed in source) + Amount uint64 + KeyOffsets []TxOutRef + KeyImage KeyImage + EtcDetails []byte // opaque variant vector +} + +// InputType returns the wire variant tag for HTLC inputs. +func (t TxInputHTLC) InputType() uint8 { return InputTypeHTLC } + +// TxInputMultisig spends from a multisig output (HF1+). +type TxInputMultisig struct { + Amount uint64 + MultisigOutID Hash // 32-byte hash identifying the multisig output + SigsCount uint64 + EtcDetails []byte // opaque variant vector +} + +// InputType returns the wire variant tag for multisig inputs. +func (t TxInputMultisig) InputType() uint8 { return InputTypeMultisig } + // TxOutputBare is a transparent (pre-Zarcanum) transaction output. type TxOutputBare struct { // Amount in atomic units. diff --git a/types/transaction_test.go b/types/transaction_test.go index 5b35974..270b273 100644 --- a/types/transaction_test.go +++ b/types/transaction_test.go @@ -30,3 +30,24 @@ func TestTxOutHTLC_TargetType_Good(t *testing.T) { t.Errorf("TargetType: got %d, want %d", target.TargetType(), TargetTypeHTLC) } } + +func TestTxInputHTLC_InputType_Good(t *testing.T) { + var input TxInput = TxInputHTLC{ + HTLCOrigin: "test", + Amount: 1000, + KeyImage: KeyImage{1}, + } + if input.InputType() != InputTypeHTLC { + t.Errorf("InputType: got %d, want %d", input.InputType(), InputTypeHTLC) + } +} + +func TestTxInputMultisig_InputType_Good(t *testing.T) { + var input TxInput = TxInputMultisig{ + Amount: 500, + SigsCount: 2, + } + if input.InputType() != InputTypeMultisig { + t.Errorf("InputType: got %d, want %d", input.InputType(), InputTypeMultisig) + } +}