Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefane Fermigier
neo
Commits
50d3b07f
Commit
50d3b07f
authored
Sep 03, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
8796c221
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
117 additions
and
0 deletions
+117
-0
go/neo/proto.go
go/neo/proto.go
+11
-0
go/neo/zproto-marshal.go
go/neo/zproto-marshal.go
+106
-0
No files found.
go/neo/proto.go
View file @
50d3b07f
...
...
@@ -992,3 +992,14 @@ type AnswerFetchObjects struct {
// objects to delete
ObjDeleteDict
map
[
zodb
.
Tid
][]
zodb
.
Oid
// serial -> []oid
}
// S -> S
type
AddTransaction
struct
{
Tid
zodb
.
Tid
User
string
Description
string
Extension
string
Packed
bool
TTid
zodb
.
Tid
OidList
[]
zodb
.
Oid
}
go/neo/zproto-marshal.go
View file @
50d3b07f
...
...
@@ -3851,6 +3851,111 @@ overflow:
return
0
,
ErrDecodeOverflow
}
// 96. AddTransaction
func
(
*
AddTransaction
)
neoMsgCode
()
uint16
{
return
96
}
func
(
p
*
AddTransaction
)
neoMsgEncodedLen
()
int
{
return
33
+
len
(
p
.
User
)
+
len
(
p
.
Description
)
+
len
(
p
.
Extension
)
+
len
(
p
.
OidList
)
*
8
}
func
(
p
*
AddTransaction
)
neoMsgEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
{
l
:=
uint32
(
len
(
p
.
User
))
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
l
)
data
=
data
[
12
:
]
copy
(
data
,
p
.
User
)
data
=
data
[
l
:
]
}
{
l
:=
uint32
(
len
(
p
.
Description
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
copy
(
data
,
p
.
Description
)
data
=
data
[
l
:
]
}
{
l
:=
uint32
(
len
(
p
.
Extension
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
copy
(
data
,
p
.
Extension
)
data
=
data
[
l
:
]
}
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
Packed
)
binary
.
BigEndian
.
PutUint64
(
data
[
1
:
],
uint64
(
p
.
TTid
))
{
l
:=
uint32
(
len
(
p
.
OidList
))
binary
.
BigEndian
.
PutUint32
(
data
[
9
:
],
l
)
data
=
data
[
13
:
]
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
OidList
[
i
]
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
((
*
a
)))
data
=
data
[
8
:
]
}
}
}
func
(
p
*
AddTransaction
)
neoMsgDecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
}
p
.
Tid
=
zodb
.
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
{
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
data
=
data
[
12
:
]
if
uint32
(
len
(
data
))
<
4
+
l
{
goto
overflow
}
nread
+=
4
+
l
p
.
User
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
}
{
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
if
uint32
(
len
(
data
))
<
4
+
l
{
goto
overflow
}
nread
+=
4
+
l
p
.
Description
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
}
{
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
if
uint32
(
len
(
data
))
<
13
+
l
{
goto
overflow
}
nread
+=
13
+
l
p
.
Extension
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
}
p
.
Packed
=
byte2bool
((
data
[
0
:
])[
0
])
p
.
TTid
=
zodb
.
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
1
:
]))
{
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
9
:
])
data
=
data
[
13
:
]
if
uint32
(
len
(
data
))
<
l
*
8
{
goto
overflow
}
nread
+=
l
*
8
p
.
OidList
=
make
([]
zodb
.
Oid
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
OidList
[
i
]
(
*
a
)
=
zodb
.
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
data
=
data
[
8
:
]
}
}
return
12
+
int
(
nread
),
nil
overflow
:
return
0
,
ErrDecodeOverflow
}
// registry of message types
var
msgTypeRegistry
=
map
[
uint16
]
reflect
.
Type
{
0
|
answerBit
:
reflect
.
TypeOf
(
Error
{}),
...
...
@@ -3949,4 +4054,5 @@ var msgTypeRegistry = map[uint16]reflect.Type{
93
|
answerBit
:
reflect
.
TypeOf
(
AnswerFetchTransactions
{}),
94
:
reflect
.
TypeOf
(
FetchObjects
{}),
95
|
answerBit
:
reflect
.
TypeOf
(
AnswerFetchObjects
{}),
96
:
reflect
.
TypeOf
(
AddTransaction
{}),
}
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