Skip to content

Commit

Permalink
Merge branch 'anylock' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
scorpiotzh committed Jun 12, 2024
2 parents d893f36 + aad957e commit 169679e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 58 deletions.
63 changes: 8 additions & 55 deletions block_parser/action_did_cell.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,12 @@ func (b *BlockParser) ActionEditDidCellRecords(req *FuncTransactionHandleReq) (r
return
}

//var didCellData witness.DidCellData
//if err := didCellData.BysToObj(req.Tx.OutputsData[txDidEntity.Outputs[0].Target.Index]); err != nil {
// resp.Err = fmt.Errorf("didCellData.BysToObj err: %s", err.Error())
// return
//}
sporeData, didCellData, err := witness.BysToDidCellData(req.Tx.OutputsData[txDidEntity.Outputs[0].Target.Index])
account, _, err := witness.GetAccountAndExpireFromDidCellData(req.Tx.OutputsData[txDidEntity.Outputs[0].Target.Index])
if err != nil {
resp.Err = fmt.Errorf("witness.BysToDidCellData err: %s", err.Error())
resp.Err = fmt.Errorf("witness.GetAccountAndExpireFromDidCellData err: %s", err.Error())
return
}
account := ""
if sporeData != nil {
didCellDataLV, err := sporeData.ContentToDidCellDataLV()
if err != nil {
resp.Err = fmt.Errorf("sporeData.ContentToDidCellDataLV err: %s", err.Error())
return
}
account = didCellDataLV.Account
} else if didCellData != nil {
account = didCellData.Account
}

accountId := common.Bytes2Hex(common.GetAccountIdByAccount(account))
var recordsInfos []tables.TableRecordsInfo
recordList := txDidEntity.Outputs[0].DidCellWitnessDataV0.Records
Expand Down Expand Up @@ -87,27 +72,12 @@ func (b *BlockParser) ActionEditDidCellOwner(req *FuncTransactionHandleReq) (res
resp.Err = fmt.Errorf("TxToOneDidEntity err: %s", err.Error())
return
}
//var didCellData witness.DidCellData
//if err := didCellData.BysToObj(req.Tx.OutputsData[didEntity.Target.Index]); err != nil {
// resp.Err = fmt.Errorf("didCellData.BysToObj err: %s", err.Error())
// return
//}
sporeData, didCellData, err := witness.BysToDidCellData(req.Tx.OutputsData[didEntity.Target.Index])

account, _, err := witness.GetAccountAndExpireFromDidCellData(req.Tx.OutputsData[didEntity.Target.Index])
if err != nil {
resp.Err = fmt.Errorf("witness.BysToDidCellData err: %s", err.Error())
resp.Err = fmt.Errorf("witness.GetAccountAndExpireFromDidCellData err: %s", err.Error())
return
}
account := ""
if sporeData != nil {
didCellDataLV, err := sporeData.ContentToDidCellDataLV()
if err != nil {
resp.Err = fmt.Errorf("sporeData.ContentToDidCellDataLV err: %s", err.Error())
return
}
account = didCellDataLV.Account
} else if didCellData != nil {
account = didCellData.Account
}

didCellArgs := common.Bytes2Hex(req.Tx.Outputs[didEntity.Target.Index].Lock.Args)
accountId := common.Bytes2Hex(common.GetAccountIdByAccount(account))
Expand Down Expand Up @@ -149,28 +119,11 @@ func (b *BlockParser) ActionDidCellRecycle(req *FuncTransactionHandleReq) (resp
log.Info("ActionDidCellRecycle:", req.BlockNumber, req.TxHash, req.Action)
preTxDidEntity, err := witness.TxToOneDidEntity(preTx.Transaction, witness.SourceTypeOutputs)

//var preDidCellData witness.DidCellData
//if err := preDidCellData.BysToObj(preTx.Transaction.OutputsData[preTxDidEntity.Target.Index]); err != nil {
// resp.Err = fmt.Errorf("didCellData.BysToObj err: %s", err.Error())
// return
//}

sporeData, didCellData, err := witness.BysToDidCellData(preTx.Transaction.OutputsData[preTxDidEntity.Target.Index])
account, _, err := witness.GetAccountAndExpireFromDidCellData(preTx.Transaction.OutputsData[preTxDidEntity.Target.Index])
if err != nil {
resp.Err = fmt.Errorf("witness.BysToDidCellData err: %s", err.Error())
resp.Err = fmt.Errorf("witness.GetAccountAndExpireFromDidCellData err: %s", err.Error())
return
}
account := ""
if sporeData != nil {
didCellDataLV, err := sporeData.ContentToDidCellDataLV()
if err != nil {
resp.Err = fmt.Errorf("sporeData.ContentToDidCellDataLV err: %s", err.Error())
return
}
account = didCellDataLV.Account
} else if didCellData != nil {
account = didCellData.Account
}

accountId := common.Bytes2Hex(common.GetAccountIdByAccount(account))
oldOutpoint := common.OutPointStruct2String(req.Tx.Inputs[0].PreviousOutput)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module das-account-indexer
go 1.18

require (
github.com/dotbitHQ/das-lib v1.1.1-0.20240606090840-e9f3a432c836
github.com/dotbitHQ/das-lib v1.1.1-0.20240612034840-4b0c2da94d04
github.com/fsnotify/fsnotify v1.5.4
github.com/gin-gonic/gin v1.9.1
github.com/go-redis/redis v6.15.9+incompatible
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5O
github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/dop251/goja v0.0.0-20211011172007-d99e4b8cbf48/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk=
github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y=
github.com/dotbitHQ/das-lib v1.1.1-0.20240606090840-e9f3a432c836 h1:/FEJmc1RM88ke4ttxHsBZHix714+0iaCDTih3tKuBn8=
github.com/dotbitHQ/das-lib v1.1.1-0.20240606090840-e9f3a432c836/go.mod h1:XrDous4HH3jze59GLdmdKZaAQ8h3unTFUBsppph7IF8=
github.com/dotbitHQ/das-lib v1.1.1-0.20240612034840-4b0c2da94d04 h1:UH8qKDMZ6RMKYipkNpzWtUjz6rjL+SgPJfgmUH4RNOs=
github.com/dotbitHQ/das-lib v1.1.1-0.20240612034840-4b0c2da94d04/go.mod h1:XrDous4HH3jze59GLdmdKZaAQ8h3unTFUBsppph7IF8=
github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts=
github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
github.com/elazarl/goproxy v0.0.0-20221015165544-a0805db90819 h1:RIB4cRk+lBqKK3Oy0r2gRX4ui7tuhiZq2SuTtTCi0/0=
Expand Down

0 comments on commit 169679e

Please sign in to comment.