Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
4264bcf1
Commit
4264bcf1
authored
Dec 10, 2021
by
harrylee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update broker
parent
36f18d1b
Pipeline
#8354
failed with stages
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
12 deletions
+3
-12
brokerdb.go
plugin/dapp/broker/executor/brokerdb.go
+3
-12
No files found.
plugin/dapp/broker/executor/brokerdb.go
View file @
4264bcf1
...
...
@@ -6,7 +6,6 @@ import (
dbm
"github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/types"
brokertypes
"github.com/33cn/plugin/plugin/dapp/broker/types"
storagetypes
"github.com/33cn/plugin/plugin/dapp/storage/types"
"strconv"
)
...
...
@@ -73,9 +72,6 @@ func (b *BrokerDB) initBroker(payload *brokertypes.Init) (*types.Receipt, error)
receipt
.
KV
=
append
(
receipt
.
KV
,
kvsets
...
)
receipt
.
KV
=
append
(
receipt
.
KV
,
&
types
.
KeyValue
{
Key
:
BxhIDKey
(),
Value
:
types
.
Encode
(
payload
)})
receipt
.
Ty
=
brokertypes
.
TyInitLog
for
_
,
v
:=
range
receipt
.
KV
{
elog
.
Error
(
"KV"
,
"key:"
,
string
(
v
.
GetKey
()),
"value"
,
string
(
v
.
GetValue
()))
}
return
receipt
,
nil
}
...
...
@@ -141,18 +137,13 @@ func (b *BrokerDB) updateIndex(payload *brokertypes.UpdateIndex) (*types.Receipt
return
receipt
,
nil
}
//TODO 重构跨链事件发布
//TODO 重构跨链事件发布
,发布跨链事件,实质是从别的应用链获取数据
func
(
b
*
BrokerDB
)
emitInterchainEvent
(
payload
*
brokertypes
.
InterchainEvent
)
(
*
types
.
Receipt
,
error
)
{
//FIXME 权限检查,是否需要设定指定账户拥有跨链的权限
receipt
:=
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
}
//发布跨链事件分为 1.信息跨链 2.代币跨链,代币跨链需要在这步将所需金额冻结在broker下面
if
payload
.
Type
==
brokertypes
.
Req_Type_Storage
{
//校验存在交易是否存在
params
:=
&
storagetypes
.
QueryStorage
{
TxHash
:
payload
.
Args
}
_
,
err
:=
b
.
api
.
Query
(
storagetypes
.
StorageX
,
"QueryStorage"
,
params
)
if
err
!=
nil
{
return
nil
,
brokertypes
.
ErrBrokerStorageTx
}
//TODO 检查有没有历史数据
meta
,
err
:=
getMeta
(
b
.
statedb
,
calOutterMetaKey
())
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"broker not init!"
)
...
...
@@ -245,7 +236,7 @@ func getMeta(statedb dbm.KV, key []byte) (*brokertypes.Meta, error) {
func
getMessage
(
statedb
dbm
.
KV
,
key
[]
byte
)
(
*
brokertypes
.
InterchainEvent
,
error
)
{
data
,
err
:=
statedb
.
Get
(
key
)
if
err
!=
nil
{
elog
.
Error
(
"getMessage"
,
"not found"
,
"key:"
,
key
)
elog
.
Error
(
"getMessage"
,
"not found"
,
"key:"
,
string
(
key
)
)
return
nil
,
err
}
var
event
brokertypes
.
InterchainEvent
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment