Skip to content

Commit

Permalink
add Opcode in payload contant (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas7788 authored Jun 5, 2019
1 parent d88c167 commit b472d6d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 3 additions & 0 deletions native_contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ var (
GOVERNANCE_CONTRACT_VERSION = byte(0)
)

var OPCODE_IN_PAYLOAD = map[byte]bool{0x00: true, 0xc6: true, 0x6b: true, 0x6a: true, 0xc8: true, 0x6c: true, 0x68: true, 0x67: true,
0x7c: true, 0x51: true, 0xc1: true}

type NativeContract struct {
ontSdk *OntologySdk
Ont *Ont
Expand Down
5 changes: 1 addition & 4 deletions ont_sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,6 @@ func readAddress(source *common.ZeroCopySource) (common2.Address, error) {
return sender, nil
}
func ignoreOpCode(source *common.ZeroCopySource) error {
opCode := make(map[byte]bool)
opCode = map[byte]bool{0x00: true, 0xc6: true, 0x6b: true, 0x6a: true, 0xc8: true, 0x6c: true, 0x68: true, 0x67: true,
0x7c: true, 0x51: true, 0xc1: true}
s := source.Size()
for {
if source.Pos() >= s {
Expand All @@ -277,7 +274,7 @@ func ignoreOpCode(source *common.ZeroCopySource) error {
if eof {
return io.EOF
}
if opCode[by] {
if OPCODE_IN_PAYLOAD[by] {
continue
} else {
return nil
Expand Down

0 comments on commit b472d6d

Please sign in to comment.