Skip to content

Commit

Permalink
feat: change ChainDataToDataPart
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleO_O committed Oct 18, 2023
1 parent c44eb45 commit c6966e4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions metaid.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func DecodeTxToDataPart(bytes []byte) (*parser.DataPart, string, []*model.MetaTx
if err != nil {
continue
}
dataPart := parser.PartsToDataPart(data)
dataPart := parser.ChainDataToDataPart(data)
dataPart.TxId = rawTx.TxID
dataPart.MetanetId = parser.MakeMetanetId(dataPart.NodePublicKey, dataPart.NodeParentTxId)
return dataPart, out.GetLockScript(), vouts, vins, true
Expand Down Expand Up @@ -53,7 +53,7 @@ func DecodeTxToDataPartForMetaFile(bytes []byte) (*parser.DataPart, string, bool
if err != nil {
continue
}
dataPart := parser.PartsToDataPart(data)
dataPart := parser.ChainDataToDataPart(data)
dataPart.TxId = rawTx.TxID
dataPart.MetanetId = parser.MakeMetanetId(dataPart.NodePublicKey, dataPart.NodeParentTxId)
return dataPart, out.GetLockScript(), true
Expand Down Expand Up @@ -125,7 +125,7 @@ func DecodeTxToDataPartForDataString(bytes []byte) (string, bool) {
if err != nil {
continue
}
dataPart := parser.PartsToDataPart(data)
dataPart := parser.ChainDataToDataPart(data)

if util.ValueOf(dataPart.Data).Kind() != reflect.String {
return "", true
Expand All @@ -147,7 +147,7 @@ func DecodeTxToDataPartForDataObj(bytes []byte) (interface{}, bool) {
if err != nil {
continue
}
dataPart := parser.PartsToDataPart(data)
dataPart := parser.ChainDataToDataPart(data)
return dataPart.Data, true
}
return "", false
Expand All @@ -164,7 +164,7 @@ func DecodeTxToDataPartForImageDataString(bytes []byte) (string, bool) {
if err != nil {
continue
}
dataPart := parser.PartsToDataPart(data)
dataPart := parser.ChainDataToDataPart(data)

if util.ValueOf(dataPart.Data).Kind() != reflect.String {
return "", true
Expand Down
2 changes: 1 addition & 1 deletion parser/meta_data_parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type DataPart struct {
Params []string `json:"params"` //extra params
}

func PartsToDataPart(parts []string) *DataPart {
func ChainDataToDataPart(parts []string) *DataPart {
chainTag := ""
nodePublicKey := ""
nodeParentChainTag := ""
Expand Down
2 changes: 1 addition & 1 deletion parser/meta_decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func TestDecodeMetaOutScript(t *testing.T) {
fmt.Println("data:")
fmt.Println(len(data))
fmt.Println(data)
da := PartsToDataPart(data)
da := ChainDataToDataPart(data)
fmt.Println(da.MetaIdTag)
}

Expand Down

0 comments on commit c6966e4

Please sign in to comment.