Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
fix(BUX-294): brought back CMPSlice in draft transaction for test pass
Browse files Browse the repository at this point in the history
  • Loading branch information
kuba-4chain committed Oct 27, 2023
1 parent 1d6d850 commit fe3eb29
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions model_draft_transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ type DraftTransaction struct {
Configuration TransactionConfig `json:"configuration" toml:"configuration" yaml:"configuration" gorm:"<-;type:text;comment:This is the configuration struct in JSON" bson:"configuration"`
Status DraftStatus `json:"status" toml:"status" yaml:"status" gorm:"<-;type:varchar(10);index;comment:This is the status of the draft" bson:"status"`
FinalTxID string `json:"final_tx_id,omitempty" toml:"final_tx_id" yaml:"final_tx_id" gorm:"<-;type:char(64);index;comment:This is the final tx ID" bson:"final_tx_id,omitempty"`
CompoundMerklePathes CMPSlice `json:"compound_merkle_pathes,omitempty" toml:"compound_merkle_pathes" yaml:"compound_merkle_pathes" gorm:"<-;type:text;comment:Slice of Compound Merkle Path" bson:"compound_merkle_pathes,omitempty"`
BumpPaths BUMPPaths `json:"bump_pathes,omitempty" toml:"bump_pathes" yaml:"bump_pathes" gorm:"<-;type:text;comment:Slice of BUMPs (BSV Unified Merkle Paths)" bson:"bump_pathes,omitempty"`
}

Expand Down Expand Up @@ -411,6 +412,13 @@ func (m *DraftTransaction) createTransactionHex(ctx context.Context) (err error)
return ErrTransactionFeeInvalid
}

for _, v := range merkleProofs {
cmp, err := CalculateCompoundMerklePath(v)
if err != nil {
return err
}
m.CompoundMerklePathes = append(m.CompoundMerklePathes, cmp)
}
for _, v := range merkleProofs {
bump, err := CalculateMergedBUMP(v)
if err != nil {
Expand Down

0 comments on commit fe3eb29

Please sign in to comment.