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
3f366492
Commit
3f366492
authored
Jan 25, 2019
by
heyubin
Committed by
vipwzw
Jan 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add by hyb for multisig tx
parent
6126c935
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
2 deletions
+34
-2
multisig.go
plugin/dapp/multisig/wallet/multisig.go
+34
-2
No files found.
plugin/dapp/multisig/wallet/multisig.go
View file @
3f366492
...
@@ -7,6 +7,7 @@ package wallet
...
@@ -7,6 +7,7 @@ package wallet
import
(
import
(
"sync"
"sync"
"github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/common/crypto"
"github.com/33cn/chain33/common/crypto"
"github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/common/log/log15"
"github.com/33cn/chain33/common/log/log15"
...
@@ -90,13 +91,13 @@ func (policy *multisigPolicy) OnImportPrivateKey(acc *types.Account) {
...
@@ -90,13 +91,13 @@ func (policy *multisigPolicy) OnImportPrivateKey(acc *types.Account) {
// OnAddBlockTx 响应区块交易添加的处理
// OnAddBlockTx 响应区块交易添加的处理
func
(
policy
*
multisigPolicy
)
OnAddBlockTx
(
block
*
types
.
BlockDetail
,
tx
*
types
.
Transaction
,
index
int32
,
dbbatch
db
.
Batch
)
*
types
.
WalletTxDetail
{
func
(
policy
*
multisigPolicy
)
OnAddBlockTx
(
block
*
types
.
BlockDetail
,
tx
*
types
.
Transaction
,
index
int32
,
dbbatch
db
.
Batch
)
*
types
.
WalletTxDetail
{
policy
.
filterMultisigTxsFromBlock
(
tx
,
index
,
block
,
dbbatch
,
true
)
policy
.
filterMultisigTxsFromBlock
(
tx
,
index
,
block
,
dbbatch
,
true
)
return
nil
return
policy
.
proceWalletTxDetail
(
block
,
tx
,
index
)
}
}
// OnDeleteBlockTx 响应删除区块交易的处理
// OnDeleteBlockTx 响应删除区块交易的处理
func
(
policy
*
multisigPolicy
)
OnDeleteBlockTx
(
block
*
types
.
BlockDetail
,
tx
*
types
.
Transaction
,
index
int32
,
dbbatch
db
.
Batch
)
*
types
.
WalletTxDetail
{
func
(
policy
*
multisigPolicy
)
OnDeleteBlockTx
(
block
*
types
.
BlockDetail
,
tx
*
types
.
Transaction
,
index
int32
,
dbbatch
db
.
Batch
)
*
types
.
WalletTxDetail
{
policy
.
filterMultisigTxsFromBlock
(
tx
,
index
,
block
,
dbbatch
,
false
)
policy
.
filterMultisigTxsFromBlock
(
tx
,
index
,
block
,
dbbatch
,
false
)
return
nil
return
policy
.
proceWalletTxDetail
(
block
,
tx
,
index
)
}
}
// OnAddBlockFinish 在区块被添加成功时做一些处理
// OnAddBlockFinish 在区块被添加成功时做一些处理
...
@@ -497,3 +498,34 @@ func (policy *multisigPolicy) proceMultiSigAcc(multiSigAccs *mtypes.ReplyMultiSi
...
@@ -497,3 +498,34 @@ func (policy *multisigPolicy) proceMultiSigAcc(multiSigAccs *mtypes.ReplyMultiSi
}
}
}
}
}
}
func
(
policy
*
multisigPolicy
)
proceWalletTxDetail
(
block
*
types
.
BlockDetail
,
tx
*
types
.
Transaction
,
index
int32
)
*
types
.
WalletTxDetail
{
receipt
:=
block
.
Receipts
[
index
]
amount
,
_
:=
tx
.
Amount
()
wtxdetail
:=
&
types
.
WalletTxDetail
{
Tx
:
tx
,
Height
:
block
.
Block
.
Height
,
Index
:
int64
(
index
),
Receipt
:
receipt
,
Blocktime
:
block
.
Block
.
BlockTime
,
ActionName
:
tx
.
ActionName
(),
Amount
:
amount
,
Payload
:
nil
,
}
if
len
(
wtxdetail
.
Fromaddr
)
<=
0
{
pubkey
:=
tx
.
Signature
.
GetPubkey
()
address
:=
address
.
PubKeyToAddress
(
pubkey
)
//from addr
fromaddress
:=
address
.
String
()
if
len
(
fromaddress
)
!=
0
&&
policy
.
walletOperate
.
AddrInWallet
(
fromaddress
)
{
wtxdetail
.
Fromaddr
=
fromaddress
}
}
if
len
(
wtxdetail
.
Fromaddr
)
<=
0
{
toaddr
:=
tx
.
GetTo
()
if
len
(
toaddr
)
!=
0
&&
policy
.
walletOperate
.
AddrInWallet
(
toaddr
)
{
wtxdetail
.
Fromaddr
=
toaddr
}
}
return
wtxdetail
}
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