Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
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
Levin Zimmermann
neoppod
Commits
c4ba3f34
Commit
c4ba3f34
authored
Apr 25, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
85666824
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
216 additions
and
200 deletions
+216
-200
go/neo/proto-marshal.go
go/neo/proto-marshal.go
+188
-188
go/neo/proto.go
go/neo/proto.go
+5
-3
go/neo/proto_test.go
go/neo/proto_test.go
+6
-2
go/neo/protogen.go
go/neo/protogen.go
+10
-5
go/neo/storage.go
go/neo/storage.go
+7
-2
No files found.
go/neo/proto-marshal.go
View file @
c4ba3f34
...
@@ -14,8 +14,8 @@ import (
...
@@ -14,8 +14,8 @@ import (
// 0. Address
// 0. Address
func
(
p
*
Address
)
NEOEncoded
Len
()
int
{
func
(
p
*
Address
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
6
+
len
(
p
.
Host
)
return
0
,
6
+
len
(
p
.
Host
)
}
}
func
(
p
*
Address
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
Address
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -53,8 +53,8 @@ overflow:
...
@@ -53,8 +53,8 @@ overflow:
// 1. NodeInfo
// 1. NodeInfo
func
(
p
*
NodeInfo
)
NEOEncoded
Len
()
int
{
func
(
p
*
NodeInfo
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
26
+
len
(
p
.
Address
.
Host
)
return
1
,
26
+
len
(
p
.
Address
.
Host
)
}
}
func
(
p
*
NodeInfo
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
NodeInfo
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -100,8 +100,8 @@ overflow:
...
@@ -100,8 +100,8 @@ overflow:
// 2. CellInfo
// 2. CellInfo
func
(
p
*
CellInfo
)
NEOEncoded
Len
()
int
{
func
(
p
*
CellInfo
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
8
return
2
,
8
}
}
func
(
p
*
CellInfo
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
CellInfo
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -123,8 +123,8 @@ overflow:
...
@@ -123,8 +123,8 @@ overflow:
// 3. RowInfo
// 3. RowInfo
func
(
p
*
RowInfo
)
NEOEncoded
Len
()
int
{
func
(
p
*
RowInfo
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
8
+
len
(
p
.
CellList
)
*
8
return
3
,
8
+
len
(
p
.
CellList
)
*
8
}
}
func
(
p
*
RowInfo
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
RowInfo
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -171,12 +171,12 @@ overflow:
...
@@ -171,12 +171,12 @@ overflow:
// 4. XXXTest
// 4. XXXTest
func
(
p
*
XXXTest
)
NEOEncoded
Len
()
int
{
func
(
p
*
XXXTest
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
var
size
int
var
size
int
for
key
:=
range
p
.
Zzz
{
for
key
:=
range
p
.
Zzz
{
size
+=
len
(
p
.
Zzz
[
key
])
size
+=
len
(
p
.
Zzz
[
key
])
}
}
return
12
+
len
(
p
.
Zzz
)
*
8
+
size
return
4
,
12
+
len
(
p
.
Zzz
)
*
8
+
size
}
}
func
(
p
*
XXXTest
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
XXXTest
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -243,8 +243,8 @@ overflow:
...
@@ -243,8 +243,8 @@ overflow:
// 5. Notify
// 5. Notify
func
(
p
*
Notify
)
NEOEncoded
Len
()
int
{
func
(
p
*
Notify
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
4
+
len
(
p
.
Message
)
return
5
,
4
+
len
(
p
.
Message
)
}
}
func
(
p
*
Notify
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
Notify
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -280,8 +280,8 @@ overflow:
...
@@ -280,8 +280,8 @@ overflow:
// 6. Error
// 6. Error
func
(
p
*
Error
)
NEOEncoded
Len
()
int
{
func
(
p
*
Error
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
8
+
len
(
p
.
Message
)
return
6
,
8
+
len
(
p
.
Message
)
}
}
func
(
p
*
Error
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
Error
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -319,8 +319,8 @@ overflow:
...
@@ -319,8 +319,8 @@ overflow:
// 7. Ping
// 7. Ping
func
(
p
*
Ping
)
NEOEncoded
Len
()
int
{
func
(
p
*
Ping
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
0
return
7
,
0
}
}
func
(
p
*
Ping
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
Ping
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -332,8 +332,8 @@ func (p *Ping) NEODecode(data []byte) (int, error) {
...
@@ -332,8 +332,8 @@ func (p *Ping) NEODecode(data []byte) (int, error) {
// 8. CloseClient
// 8. CloseClient
func
(
p
*
CloseClient
)
NEOEncoded
Len
()
int
{
func
(
p
*
CloseClient
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
0
return
8
,
0
}
}
func
(
p
*
CloseClient
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
CloseClient
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -345,8 +345,8 @@ func (p *CloseClient) NEODecode(data []byte) (int, error) {
...
@@ -345,8 +345,8 @@ func (p *CloseClient) NEODecode(data []byte) (int, error) {
// 9. RequestIdentification
// 9. RequestIdentification
func
(
p
*
RequestIdentification
)
NEOEncoded
Len
()
int
{
func
(
p
*
RequestIdentification
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
30
+
len
(
p
.
Address
.
Host
)
+
len
(
p
.
Name
)
return
9
,
30
+
len
(
p
.
Address
.
Host
)
+
len
(
p
.
Name
)
}
}
func
(
p
*
RequestIdentification
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
RequestIdentification
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -409,13 +409,13 @@ overflow:
...
@@ -409,13 +409,13 @@ overflow:
// 10. AcceptIdentification
// 10. AcceptIdentification
func
(
p
*
AcceptIdentification
)
NEOEncoded
Len
()
int
{
func
(
p
*
AcceptIdentification
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
var
size
int
var
size
int
for
i
:=
0
;
i
<
len
(
p
.
KnownMasterList
);
i
++
{
for
i
:=
0
;
i
<
len
(
p
.
KnownMasterList
);
i
++
{
a
:=
&
p
.
KnownMasterList
[
i
]
a
:=
&
p
.
KnownMasterList
[
i
]
size
+=
len
((
*
a
)
.
Address
.
Host
)
size
+=
len
((
*
a
)
.
Address
.
Host
)
}
}
return
30
+
len
(
p
.
Primary
.
Host
)
+
len
(
p
.
KnownMasterList
)
*
10
+
size
return
10
,
30
+
len
(
p
.
Primary
.
Host
)
+
len
(
p
.
KnownMasterList
)
*
10
+
size
}
}
func
(
p
*
AcceptIdentification
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AcceptIdentification
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -509,8 +509,8 @@ overflow:
...
@@ -509,8 +509,8 @@ overflow:
// 11. PrimaryMaster
// 11. PrimaryMaster
func
(
p
*
PrimaryMaster
)
NEOEncoded
Len
()
int
{
func
(
p
*
PrimaryMaster
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
0
return
11
,
0
}
}
func
(
p
*
PrimaryMaster
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
PrimaryMaster
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -522,8 +522,8 @@ func (p *PrimaryMaster) NEODecode(data []byte) (int, error) {
...
@@ -522,8 +522,8 @@ func (p *PrimaryMaster) NEODecode(data []byte) (int, error) {
// 12. AnswerPrimary
// 12. AnswerPrimary
func
(
p
*
AnswerPrimary
)
NEOEncoded
Len
()
int
{
func
(
p
*
AnswerPrimary
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
4
return
12
,
4
}
}
func
(
p
*
AnswerPrimary
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerPrimary
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -543,8 +543,8 @@ overflow:
...
@@ -543,8 +543,8 @@ overflow:
// 13. AnnouncePrimary
// 13. AnnouncePrimary
func
(
p
*
AnnouncePrimary
)
NEOEncoded
Len
()
int
{
func
(
p
*
AnnouncePrimary
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
0
return
13
,
0
}
}
func
(
p
*
AnnouncePrimary
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnnouncePrimary
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -556,8 +556,8 @@ func (p *AnnouncePrimary) NEODecode(data []byte) (int, error) {
...
@@ -556,8 +556,8 @@ func (p *AnnouncePrimary) NEODecode(data []byte) (int, error) {
// 14. ReelectPrimary
// 14. ReelectPrimary
func
(
p
*
ReelectPrimary
)
NEOEncoded
Len
()
int
{
func
(
p
*
ReelectPrimary
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
0
return
14
,
0
}
}
func
(
p
*
ReelectPrimary
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
ReelectPrimary
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -569,8 +569,8 @@ func (p *ReelectPrimary) NEODecode(data []byte) (int, error) {
...
@@ -569,8 +569,8 @@ func (p *ReelectPrimary) NEODecode(data []byte) (int, error) {
// 15. Recovery
// 15. Recovery
func
(
p
*
Recovery
)
NEOEncoded
Len
()
int
{
func
(
p
*
Recovery
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
0
return
15
,
0
}
}
func
(
p
*
Recovery
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
Recovery
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -582,8 +582,8 @@ func (p *Recovery) NEODecode(data []byte) (int, error) {
...
@@ -582,8 +582,8 @@ func (p *Recovery) NEODecode(data []byte) (int, error) {
// 16. AnswerRecovery
// 16. AnswerRecovery
func
(
p
*
AnswerRecovery
)
NEOEncoded
Len
()
int
{
func
(
p
*
AnswerRecovery
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
24
return
16
,
24
}
}
func
(
p
*
AnswerRecovery
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerRecovery
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -607,8 +607,8 @@ overflow:
...
@@ -607,8 +607,8 @@ overflow:
// 17. LastIDs
// 17. LastIDs
func
(
p
*
LastIDs
)
NEOEncoded
Len
()
int
{
func
(
p
*
LastIDs
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
0
return
17
,
0
}
}
func
(
p
*
LastIDs
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
LastIDs
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -620,8 +620,8 @@ func (p *LastIDs) NEODecode(data []byte) (int, error) {
...
@@ -620,8 +620,8 @@ func (p *LastIDs) NEODecode(data []byte) (int, error) {
// 18. AnswerLastIDs
// 18. AnswerLastIDs
func
(
p
*
AnswerLastIDs
)
NEOEncoded
Len
()
int
{
func
(
p
*
AnswerLastIDs
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
16
return
1
8
,
1
6
}
}
func
(
p
*
AnswerLastIDs
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerLastIDs
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -643,8 +643,8 @@ overflow:
...
@@ -643,8 +643,8 @@ overflow:
// 19. PartitionTable
// 19. PartitionTable
func
(
p
*
PartitionTable
)
NEOEncoded
Len
()
int
{
func
(
p
*
PartitionTable
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
0
return
19
,
0
}
}
func
(
p
*
PartitionTable
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
PartitionTable
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -656,13 +656,13 @@ func (p *PartitionTable) NEODecode(data []byte) (int, error) {
...
@@ -656,13 +656,13 @@ func (p *PartitionTable) NEODecode(data []byte) (int, error) {
// 20. AnswerPartitionTable
// 20. AnswerPartitionTable
func
(
p
*
AnswerPartitionTable
)
NEOEncoded
Len
()
int
{
func
(
p
*
AnswerPartitionTable
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
var
size
int
var
size
int
for
i
:=
0
;
i
<
len
(
p
.
RowList
);
i
++
{
for
i
:=
0
;
i
<
len
(
p
.
RowList
);
i
++
{
a
:=
&
p
.
RowList
[
i
]
a
:=
&
p
.
RowList
[
i
]
size
+=
len
((
*
a
)
.
CellList
)
*
8
size
+=
len
((
*
a
)
.
CellList
)
*
8
}
}
return
12
+
len
(
p
.
RowList
)
*
8
+
size
return
20
,
12
+
len
(
p
.
RowList
)
*
8
+
size
}
}
func
(
p
*
AnswerPartitionTable
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerPartitionTable
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -732,13 +732,13 @@ overflow:
...
@@ -732,13 +732,13 @@ overflow:
// 21. NotifyPartitionTable
// 21. NotifyPartitionTable
func
(
p
*
NotifyPartitionTable
)
NEOEncoded
Len
()
int
{
func
(
p
*
NotifyPartitionTable
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
var
size
int
var
size
int
for
i
:=
0
;
i
<
len
(
p
.
RowList
);
i
++
{
for
i
:=
0
;
i
<
len
(
p
.
RowList
);
i
++
{
a
:=
&
p
.
RowList
[
i
]
a
:=
&
p
.
RowList
[
i
]
size
+=
len
((
*
a
)
.
CellList
)
*
8
size
+=
len
((
*
a
)
.
CellList
)
*
8
}
}
return
12
+
len
(
p
.
RowList
)
*
8
+
size
return
21
,
12
+
len
(
p
.
RowList
)
*
8
+
size
}
}
func
(
p
*
NotifyPartitionTable
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
NotifyPartitionTable
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -808,8 +808,8 @@ overflow:
...
@@ -808,8 +808,8 @@ overflow:
// 22. PartitionChanges
// 22. PartitionChanges
func
(
p
*
PartitionChanges
)
NEOEncoded
Len
()
int
{
func
(
p
*
PartitionChanges
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
12
+
len
(
p
.
CellList
)
*
12
return
22
,
12
+
len
(
p
.
CellList
)
*
12
}
}
func
(
p
*
PartitionChanges
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
PartitionChanges
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -862,8 +862,8 @@ overflow:
...
@@ -862,8 +862,8 @@ overflow:
// 23. StartOperation
// 23. StartOperation
func
(
p
*
StartOperation
)
NEOEncoded
Len
()
int
{
func
(
p
*
StartOperation
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
1
return
23
,
1
}
}
func
(
p
*
StartOperation
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
StartOperation
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -883,8 +883,8 @@ overflow:
...
@@ -883,8 +883,8 @@ overflow:
// 24. StopOperation
// 24. StopOperation
func
(
p
*
StopOperation
)
NEOEncoded
Len
()
int
{
func
(
p
*
StopOperation
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
0
return
24
,
0
}
}
func
(
p
*
StopOperation
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
StopOperation
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -896,8 +896,8 @@ func (p *StopOperation) NEODecode(data []byte) (int, error) {
...
@@ -896,8 +896,8 @@ func (p *StopOperation) NEODecode(data []byte) (int, error) {
// 25. UnfinishedTransactions
// 25. UnfinishedTransactions
func
(
p
*
UnfinishedTransactions
)
NEOEncoded
Len
()
int
{
func
(
p
*
UnfinishedTransactions
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
4
+
len
(
p
.
RowList
)
*
4
return
25
,
4
+
len
(
p
.
RowList
)
*
4
}
}
func
(
p
*
UnfinishedTransactions
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
UnfinishedTransactions
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -940,8 +940,8 @@ overflow:
...
@@ -940,8 +940,8 @@ overflow:
// 26. AnswerUnfinishedTransactions
// 26. AnswerUnfinishedTransactions
func
(
p
*
AnswerUnfinishedTransactions
)
NEOEncoded
Len
()
int
{
func
(
p
*
AnswerUnfinishedTransactions
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
12
+
len
(
p
.
TidList
)
*
8
return
26
,
12
+
len
(
p
.
TidList
)
*
8
}
}
func
(
p
*
AnswerUnfinishedTransactions
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerUnfinishedTransactions
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -986,8 +986,8 @@ overflow:
...
@@ -986,8 +986,8 @@ overflow:
// 27. LockedTransactions
// 27. LockedTransactions
func
(
p
*
LockedTransactions
)
NEOEncoded
Len
()
int
{
func
(
p
*
LockedTransactions
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
0
return
27
,
0
}
}
func
(
p
*
LockedTransactions
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
LockedTransactions
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -999,8 +999,8 @@ func (p *LockedTransactions) NEODecode(data []byte) (int, error) {
...
@@ -999,8 +999,8 @@ func (p *LockedTransactions) NEODecode(data []byte) (int, error) {
// 28. AnswerLockedTransactions
// 28. AnswerLockedTransactions
func
(
p
*
AnswerLockedTransactions
)
NEOEncoded
Len
()
int
{
func
(
p
*
AnswerLockedTransactions
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
4
+
len
(
p
.
TidDict
)
*
16
return
28
,
4
+
len
(
p
.
TidDict
)
*
16
}
}
func
(
p
*
AnswerLockedTransactions
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerLockedTransactions
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -1049,8 +1049,8 @@ overflow:
...
@@ -1049,8 +1049,8 @@ overflow:
// 29. FinalTID
// 29. FinalTID
func
(
p
*
FinalTID
)
NEOEncoded
Len
()
int
{
func
(
p
*
FinalTID
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
8
return
29
,
8
}
}
func
(
p
*
FinalTID
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
FinalTID
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -1070,8 +1070,8 @@ overflow:
...
@@ -1070,8 +1070,8 @@ overflow:
// 30. AnswerFinalTID
// 30. AnswerFinalTID
func
(
p
*
AnswerFinalTID
)
NEOEncoded
Len
()
int
{
func
(
p
*
AnswerFinalTID
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
8
return
30
,
8
}
}
func
(
p
*
AnswerFinalTID
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerFinalTID
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -1091,8 +1091,8 @@ overflow:
...
@@ -1091,8 +1091,8 @@ overflow:
// 31. ValidateTransaction
// 31. ValidateTransaction
func
(
p
*
ValidateTransaction
)
NEOEncoded
Len
()
int
{
func
(
p
*
ValidateTransaction
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
16
return
31
,
16
}
}
func
(
p
*
ValidateTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
ValidateTransaction
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -1114,8 +1114,8 @@ overflow:
...
@@ -1114,8 +1114,8 @@ overflow:
// 32. BeginTransaction
// 32. BeginTransaction
func
(
p
*
BeginTransaction
)
NEOEncoded
Len
()
int
{
func
(
p
*
BeginTransaction
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
8
return
32
,
8
}
}
func
(
p
*
BeginTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
BeginTransaction
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -1135,8 +1135,8 @@ overflow:
...
@@ -1135,8 +1135,8 @@ overflow:
// 33. AnswerBeginTransaction
// 33. AnswerBeginTransaction
func
(
p
*
AnswerBeginTransaction
)
NEOEncoded
Len
()
int
{
func
(
p
*
AnswerBeginTransaction
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
8
return
33
,
8
}
}
func
(
p
*
AnswerBeginTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerBeginTransaction
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -1156,8 +1156,8 @@ overflow:
...
@@ -1156,8 +1156,8 @@ overflow:
// 34. FailedVote
// 34. FailedVote
func
(
p
*
FailedVote
)
NEOEncoded
Len
()
int
{
func
(
p
*
FailedVote
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
12
+
len
(
p
.
UUIDList
)
*
4
return
34
,
12
+
len
(
p
.
UUIDList
)
*
4
}
}
func
(
p
*
FailedVote
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
FailedVote
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -1202,8 +1202,8 @@ overflow:
...
@@ -1202,8 +1202,8 @@ overflow:
// 35. FinishTransaction
// 35. FinishTransaction
func
(
p
*
FinishTransaction
)
NEOEncoded
Len
()
int
{
func
(
p
*
FinishTransaction
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
16
+
len
(
p
.
OIDList
)
*
8
+
len
(
p
.
CheckedList
)
*
8
return
35
,
16
+
len
(
p
.
OIDList
)
*
8
+
len
(
p
.
CheckedList
)
*
8
}
}
func
(
p
*
FinishTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
FinishTransaction
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -1272,8 +1272,8 @@ overflow:
...
@@ -1272,8 +1272,8 @@ overflow:
// 36. AnswerFinishTransaction
// 36. AnswerFinishTransaction
func
(
p
*
AnswerFinishTransaction
)
NEOEncoded
Len
()
int
{
func
(
p
*
AnswerFinishTransaction
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
16
return
36
,
16
}
}
func
(
p
*
AnswerFinishTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerFinishTransaction
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -1295,8 +1295,8 @@ overflow:
...
@@ -1295,8 +1295,8 @@ overflow:
// 37. NotifyTransactionFinished
// 37. NotifyTransactionFinished
func
(
p
*
NotifyTransactionFinished
)
NEOEncoded
Len
()
int
{
func
(
p
*
NotifyTransactionFinished
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
16
return
37
,
16
}
}
func
(
p
*
NotifyTransactionFinished
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
NotifyTransactionFinished
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -1318,8 +1318,8 @@ overflow:
...
@@ -1318,8 +1318,8 @@ overflow:
// 38. LockInformation
// 38. LockInformation
func
(
p
*
LockInformation
)
NEOEncoded
Len
()
int
{
func
(
p
*
LockInformation
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
16
return
38
,
16
}
}
func
(
p
*
LockInformation
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
LockInformation
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -1341,8 +1341,8 @@ overflow:
...
@@ -1341,8 +1341,8 @@ overflow:
// 39. AnswerLockInformation
// 39. AnswerLockInformation
func
(
p
*
AnswerLockInformation
)
NEOEncoded
Len
()
int
{
func
(
p
*
AnswerLockInformation
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
8
return
39
,
8
}
}
func
(
p
*
AnswerLockInformation
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerLockInformation
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -1362,8 +1362,8 @@ overflow:
...
@@ -1362,8 +1362,8 @@ overflow:
// 40. InvalidateObjects
// 40. InvalidateObjects
func
(
p
*
InvalidateObjects
)
NEOEncoded
Len
()
int
{
func
(
p
*
InvalidateObjects
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
12
+
len
(
p
.
OidList
)
*
8
return
40
,
12
+
len
(
p
.
OidList
)
*
8
}
}
func
(
p
*
InvalidateObjects
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
InvalidateObjects
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -1408,8 +1408,8 @@ overflow:
...
@@ -1408,8 +1408,8 @@ overflow:
// 41. UnlockInformation
// 41. UnlockInformation
func
(
p
*
UnlockInformation
)
NEOEncoded
Len
()
int
{
func
(
p
*
UnlockInformation
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
8
return
41
,
8
}
}
func
(
p
*
UnlockInformation
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
UnlockInformation
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -1429,8 +1429,8 @@ overflow:
...
@@ -1429,8 +1429,8 @@ overflow:
// 42. GenerateOIDs
// 42. GenerateOIDs
func
(
p
*
GenerateOIDs
)
NEOEncoded
Len
()
int
{
func
(
p
*
GenerateOIDs
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
4
return
4
2
,
4
}
}
func
(
p
*
GenerateOIDs
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
GenerateOIDs
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -1450,8 +1450,8 @@ overflow:
...
@@ -1450,8 +1450,8 @@ overflow:
// 43. AnswerGenerateOIDs
// 43. AnswerGenerateOIDs
func
(
p
*
AnswerGenerateOIDs
)
NEOEncoded
Len
()
int
{
func
(
p
*
AnswerGenerateOIDs
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
4
+
len
(
p
.
OidList
)
*
8
return
4
3
,
4
+
len
(
p
.
OidList
)
*
8
}
}
func
(
p
*
AnswerGenerateOIDs
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerGenerateOIDs
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -1494,8 +1494,8 @@ overflow:
...
@@ -1494,8 +1494,8 @@ overflow:
// 44. Deadlock
// 44. Deadlock
func
(
p
*
Deadlock
)
NEOEncoded
Len
()
int
{
func
(
p
*
Deadlock
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
16
return
44
,
16
}
}
func
(
p
*
Deadlock
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
Deadlock
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -1517,8 +1517,8 @@ overflow:
...
@@ -1517,8 +1517,8 @@ overflow:
// 45. RebaseTransaction
// 45. RebaseTransaction
func
(
p
*
RebaseTransaction
)
NEOEncoded
Len
()
int
{
func
(
p
*
RebaseTransaction
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
16
return
45
,
16
}
}
func
(
p
*
RebaseTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
RebaseTransaction
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -1540,8 +1540,8 @@ overflow:
...
@@ -1540,8 +1540,8 @@ overflow:
// 46. AnswerRebaseTransaction
// 46. AnswerRebaseTransaction
func
(
p
*
AnswerRebaseTransaction
)
NEOEncoded
Len
()
int
{
func
(
p
*
AnswerRebaseTransaction
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
4
+
len
(
p
.
OidList
)
*
8
return
4
6
,
4
+
len
(
p
.
OidList
)
*
8
}
}
func
(
p
*
AnswerRebaseTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerRebaseTransaction
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -1584,8 +1584,8 @@ overflow:
...
@@ -1584,8 +1584,8 @@ overflow:
// 47. RebaseObject
// 47. RebaseObject
func
(
p
*
RebaseObject
)
NEOEncoded
Len
()
int
{
func
(
p
*
RebaseObject
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
16
return
47
,
16
}
}
func
(
p
*
RebaseObject
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
RebaseObject
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -1607,8 +1607,8 @@ overflow:
...
@@ -1607,8 +1607,8 @@ overflow:
// 48. AnswerRebaseObject
// 48. AnswerRebaseObject
func
(
p
*
AnswerRebaseObject
)
NEOEncoded
Len
()
int
{
func
(
p
*
AnswerRebaseObject
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
41
+
len
(
p
.
Data
)
return
4
8
,
4
1
+
len
(
p
.
Data
)
}
}
func
(
p
*
AnswerRebaseObject
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerRebaseObject
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -1653,8 +1653,8 @@ overflow:
...
@@ -1653,8 +1653,8 @@ overflow:
// 49. StoreObject
// 49. StoreObject
func
(
p
*
StoreObject
)
NEOEncoded
Len
()
int
{
func
(
p
*
StoreObject
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
57
+
len
(
p
.
Data
)
return
49
,
57
+
len
(
p
.
Data
)
}
}
func
(
p
*
StoreObject
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
StoreObject
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -1703,8 +1703,8 @@ overflow:
...
@@ -1703,8 +1703,8 @@ overflow:
// 50. AnswerStoreObject
// 50. AnswerStoreObject
func
(
p
*
AnswerStoreObject
)
NEOEncoded
Len
()
int
{
func
(
p
*
AnswerStoreObject
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
8
return
50
,
8
}
}
func
(
p
*
AnswerStoreObject
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerStoreObject
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -1724,8 +1724,8 @@ overflow:
...
@@ -1724,8 +1724,8 @@ overflow:
// 51. AbortTransaction
// 51. AbortTransaction
func
(
p
*
AbortTransaction
)
NEOEncoded
Len
()
int
{
func
(
p
*
AbortTransaction
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
12
+
len
(
p
.
UUIDList
)
*
4
return
51
,
12
+
len
(
p
.
UUIDList
)
*
4
}
}
func
(
p
*
AbortTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AbortTransaction
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -1770,8 +1770,8 @@ overflow:
...
@@ -1770,8 +1770,8 @@ overflow:
// 52. StoreTransaction
// 52. StoreTransaction
func
(
p
*
StoreTransaction
)
NEOEncoded
Len
()
int
{
func
(
p
*
StoreTransaction
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
24
+
len
(
p
.
User
)
+
len
(
p
.
Description
)
+
len
(
p
.
Extension
)
+
len
(
p
.
OidList
)
*
8
return
52
,
24
+
len
(
p
.
User
)
+
len
(
p
.
Description
)
+
len
(
p
.
Extension
)
+
len
(
p
.
OidList
)
*
8
}
}
func
(
p
*
StoreTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
StoreTransaction
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -1867,8 +1867,8 @@ overflow:
...
@@ -1867,8 +1867,8 @@ overflow:
// 53. VoteTransaction
// 53. VoteTransaction
func
(
p
*
VoteTransaction
)
NEOEncoded
Len
()
int
{
func
(
p
*
VoteTransaction
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
8
return
53
,
8
}
}
func
(
p
*
VoteTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
VoteTransaction
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -1888,8 +1888,8 @@ overflow:
...
@@ -1888,8 +1888,8 @@ overflow:
// 54. GetObject
// 54. GetObject
func
(
p
*
GetObject
)
NEOEncoded
Len
()
int
{
func
(
p
*
GetObject
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
24
return
54
,
24
}
}
func
(
p
*
GetObject
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
GetObject
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -1913,8 +1913,8 @@ overflow:
...
@@ -1913,8 +1913,8 @@ overflow:
// 55. AnswerGetObject
// 55. AnswerGetObject
func
(
p
*
AnswerGetObject
)
NEOEncoded
Len
()
int
{
func
(
p
*
AnswerGetObject
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
57
+
len
(
p
.
Data
)
return
5
5
,
5
7
+
len
(
p
.
Data
)
}
}
func
(
p
*
AnswerGetObject
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerGetObject
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -1963,8 +1963,8 @@ overflow:
...
@@ -1963,8 +1963,8 @@ overflow:
// 56. TIDList
// 56. TIDList
func
(
p
*
TIDList
)
NEOEncoded
Len
()
int
{
func
(
p
*
TIDList
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
20
return
56
,
20
}
}
func
(
p
*
TIDList
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
TIDList
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -1988,8 +1988,8 @@ overflow:
...
@@ -1988,8 +1988,8 @@ overflow:
// 57. AnswerTIDList
// 57. AnswerTIDList
func
(
p
*
AnswerTIDList
)
NEOEncoded
Len
()
int
{
func
(
p
*
AnswerTIDList
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
4
+
len
(
p
.
TIDList
)
*
8
return
57
,
4
+
len
(
p
.
TIDList
)
*
8
}
}
func
(
p
*
AnswerTIDList
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerTIDList
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -2032,8 +2032,8 @@ overflow:
...
@@ -2032,8 +2032,8 @@ overflow:
// 58. TIDListFrom
// 58. TIDListFrom
func
(
p
*
TIDListFrom
)
NEOEncoded
Len
()
int
{
func
(
p
*
TIDListFrom
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
24
return
58
,
24
}
}
func
(
p
*
TIDListFrom
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
TIDListFrom
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -2059,8 +2059,8 @@ overflow:
...
@@ -2059,8 +2059,8 @@ overflow:
// 59. AnswerTIDListFrom
// 59. AnswerTIDListFrom
func
(
p
*
AnswerTIDListFrom
)
NEOEncoded
Len
()
int
{
func
(
p
*
AnswerTIDListFrom
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
4
+
len
(
p
.
TidList
)
*
8
return
59
,
4
+
len
(
p
.
TidList
)
*
8
}
}
func
(
p
*
AnswerTIDListFrom
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerTIDListFrom
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -2103,8 +2103,8 @@ overflow:
...
@@ -2103,8 +2103,8 @@ overflow:
// 60. TransactionInformation
// 60. TransactionInformation
func
(
p
*
TransactionInformation
)
NEOEncoded
Len
()
int
{
func
(
p
*
TransactionInformation
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
8
return
60
,
8
}
}
func
(
p
*
TransactionInformation
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
TransactionInformation
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -2124,8 +2124,8 @@ overflow:
...
@@ -2124,8 +2124,8 @@ overflow:
// 61. AnswerTransactionInformation
// 61. AnswerTransactionInformation
func
(
p
*
AnswerTransactionInformation
)
NEOEncoded
Len
()
int
{
func
(
p
*
AnswerTransactionInformation
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
25
+
len
(
p
.
User
)
+
len
(
p
.
Description
)
+
len
(
p
.
Extension
)
+
len
(
p
.
OidList
)
*
8
return
61
,
25
+
len
(
p
.
User
)
+
len
(
p
.
Description
)
+
len
(
p
.
Extension
)
+
len
(
p
.
OidList
)
*
8
}
}
func
(
p
*
AnswerTransactionInformation
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerTransactionInformation
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -2223,8 +2223,8 @@ overflow:
...
@@ -2223,8 +2223,8 @@ overflow:
// 62. ObjectHistory
// 62. ObjectHistory
func
(
p
*
ObjectHistory
)
NEOEncoded
Len
()
int
{
func
(
p
*
ObjectHistory
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
24
return
62
,
24
}
}
func
(
p
*
ObjectHistory
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
ObjectHistory
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -2248,8 +2248,8 @@ overflow:
...
@@ -2248,8 +2248,8 @@ overflow:
// 63. AnswerObjectHistory
// 63. AnswerObjectHistory
func
(
p
*
AnswerObjectHistory
)
NEOEncoded
Len
()
int
{
func
(
p
*
AnswerObjectHistory
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
12
+
len
(
p
.
HistoryList
)
*
12
return
63
,
12
+
len
(
p
.
HistoryList
)
*
12
}
}
func
(
p
*
AnswerObjectHistory
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerObjectHistory
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -2299,8 +2299,8 @@ overflow:
...
@@ -2299,8 +2299,8 @@ overflow:
// 64. PartitionList
// 64. PartitionList
func
(
p
*
PartitionList
)
NEOEncoded
Len
()
int
{
func
(
p
*
PartitionList
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
12
return
64
,
12
}
}
func
(
p
*
PartitionList
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
PartitionList
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -2324,13 +2324,13 @@ overflow:
...
@@ -2324,13 +2324,13 @@ overflow:
// 65. AnswerPartitionList
// 65. AnswerPartitionList
func
(
p
*
AnswerPartitionList
)
NEOEncoded
Len
()
int
{
func
(
p
*
AnswerPartitionList
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
var
size
int
var
size
int
for
i
:=
0
;
i
<
len
(
p
.
RowList
);
i
++
{
for
i
:=
0
;
i
<
len
(
p
.
RowList
);
i
++
{
a
:=
&
p
.
RowList
[
i
]
a
:=
&
p
.
RowList
[
i
]
size
+=
len
((
*
a
)
.
CellList
)
*
8
size
+=
len
((
*
a
)
.
CellList
)
*
8
}
}
return
12
+
len
(
p
.
RowList
)
*
8
+
size
return
65
,
12
+
len
(
p
.
RowList
)
*
8
+
size
}
}
func
(
p
*
AnswerPartitionList
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerPartitionList
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -2400,8 +2400,8 @@ overflow:
...
@@ -2400,8 +2400,8 @@ overflow:
// 66. X_NodeList
// 66. X_NodeList
func
(
p
*
X_NodeList
)
NEOEncoded
Len
()
int
{
func
(
p
*
X_NodeList
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
4
return
66
,
4
}
}
func
(
p
*
X_NodeList
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
X_NodeList
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -2421,13 +2421,13 @@ overflow:
...
@@ -2421,13 +2421,13 @@ overflow:
// 67. AnswerNodeList
// 67. AnswerNodeList
func
(
p
*
AnswerNodeList
)
NEOEncoded
Len
()
int
{
func
(
p
*
AnswerNodeList
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
var
size
int
var
size
int
for
i
:=
0
;
i
<
len
(
p
.
NodeList
);
i
++
{
for
i
:=
0
;
i
<
len
(
p
.
NodeList
);
i
++
{
a
:=
&
p
.
NodeList
[
i
]
a
:=
&
p
.
NodeList
[
i
]
size
+=
len
((
*
a
)
.
Address
.
Host
)
size
+=
len
((
*
a
)
.
Address
.
Host
)
}
}
return
4
+
len
(
p
.
NodeList
)
*
26
+
size
return
67
,
4
+
len
(
p
.
NodeList
)
*
26
+
size
}
}
func
(
p
*
AnswerNodeList
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerNodeList
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -2495,8 +2495,8 @@ overflow:
...
@@ -2495,8 +2495,8 @@ overflow:
// 68. SetNodeState
// 68. SetNodeState
func
(
p
*
SetNodeState
)
NEOEncoded
Len
()
int
{
func
(
p
*
SetNodeState
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
8
return
68
,
8
}
}
func
(
p
*
SetNodeState
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
SetNodeState
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -2518,8 +2518,8 @@ overflow:
...
@@ -2518,8 +2518,8 @@ overflow:
// 69. AddPendingNodes
// 69. AddPendingNodes
func
(
p
*
AddPendingNodes
)
NEOEncoded
Len
()
int
{
func
(
p
*
AddPendingNodes
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
4
+
len
(
p
.
UUIDList
)
*
4
return
69
,
4
+
len
(
p
.
UUIDList
)
*
4
}
}
func
(
p
*
AddPendingNodes
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AddPendingNodes
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -2562,8 +2562,8 @@ overflow:
...
@@ -2562,8 +2562,8 @@ overflow:
// 70. TweakPartitionTable
// 70. TweakPartitionTable
func
(
p
*
TweakPartitionTable
)
NEOEncoded
Len
()
int
{
func
(
p
*
TweakPartitionTable
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
4
+
len
(
p
.
UUIDList
)
*
4
return
70
,
4
+
len
(
p
.
UUIDList
)
*
4
}
}
func
(
p
*
TweakPartitionTable
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
TweakPartitionTable
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -2606,13 +2606,13 @@ overflow:
...
@@ -2606,13 +2606,13 @@ overflow:
// 71. NotifyNodeInformation
// 71. NotifyNodeInformation
func
(
p
*
NotifyNodeInformation
)
NEOEncoded
Len
()
int
{
func
(
p
*
NotifyNodeInformation
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
var
size
int
var
size
int
for
i
:=
0
;
i
<
len
(
p
.
NodeList
);
i
++
{
for
i
:=
0
;
i
<
len
(
p
.
NodeList
);
i
++
{
a
:=
&
p
.
NodeList
[
i
]
a
:=
&
p
.
NodeList
[
i
]
size
+=
len
((
*
a
)
.
Address
.
Host
)
size
+=
len
((
*
a
)
.
Address
.
Host
)
}
}
return
12
+
len
(
p
.
NodeList
)
*
26
+
size
return
71
,
12
+
len
(
p
.
NodeList
)
*
26
+
size
}
}
func
(
p
*
NotifyNodeInformation
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
NotifyNodeInformation
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -2682,8 +2682,8 @@ overflow:
...
@@ -2682,8 +2682,8 @@ overflow:
// 72. NodeInformation
// 72. NodeInformation
func
(
p
*
NodeInformation
)
NEOEncoded
Len
()
int
{
func
(
p
*
NodeInformation
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
0
return
72
,
0
}
}
func
(
p
*
NodeInformation
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
NodeInformation
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -2695,8 +2695,8 @@ func (p *NodeInformation) NEODecode(data []byte) (int, error) {
...
@@ -2695,8 +2695,8 @@ func (p *NodeInformation) NEODecode(data []byte) (int, error) {
// 73. SetClusterState
// 73. SetClusterState
func
(
p
*
SetClusterState
)
NEOEncoded
Len
()
int
{
func
(
p
*
SetClusterState
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
4
return
73
,
4
}
}
func
(
p
*
SetClusterState
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
SetClusterState
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -2716,8 +2716,8 @@ overflow:
...
@@ -2716,8 +2716,8 @@ overflow:
// 74. repairFlags
// 74. repairFlags
func
(
p
*
repairFlags
)
NEOEncoded
Len
()
int
{
func
(
p
*
repairFlags
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
1
return
74
,
1
}
}
func
(
p
*
repairFlags
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
repairFlags
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -2737,8 +2737,8 @@ overflow:
...
@@ -2737,8 +2737,8 @@ overflow:
// 75. Repair
// 75. Repair
func
(
p
*
Repair
)
NEOEncoded
Len
()
int
{
func
(
p
*
Repair
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
5
+
len
(
p
.
UUIDList
)
*
4
return
75
,
5
+
len
(
p
.
UUIDList
)
*
4
}
}
func
(
p
*
Repair
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
Repair
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -2783,8 +2783,8 @@ overflow:
...
@@ -2783,8 +2783,8 @@ overflow:
// 76. RepairOne
// 76. RepairOne
func
(
p
*
RepairOne
)
NEOEncoded
Len
()
int
{
func
(
p
*
RepairOne
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
1
return
76
,
1
}
}
func
(
p
*
RepairOne
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
RepairOne
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -2804,8 +2804,8 @@ overflow:
...
@@ -2804,8 +2804,8 @@ overflow:
// 77. ClusterInformation
// 77. ClusterInformation
func
(
p
*
ClusterInformation
)
NEOEncoded
Len
()
int
{
func
(
p
*
ClusterInformation
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
4
return
77
,
4
}
}
func
(
p
*
ClusterInformation
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
ClusterInformation
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -2825,8 +2825,8 @@ overflow:
...
@@ -2825,8 +2825,8 @@ overflow:
// 78. X_ClusterState
// 78. X_ClusterState
func
(
p
*
X_ClusterState
)
NEOEncoded
Len
()
int
{
func
(
p
*
X_ClusterState
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
4
return
78
,
4
}
}
func
(
p
*
X_ClusterState
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
X_ClusterState
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -2846,8 +2846,8 @@ overflow:
...
@@ -2846,8 +2846,8 @@ overflow:
// 79. ObjectUndoSerial
// 79. ObjectUndoSerial
func
(
p
*
ObjectUndoSerial
)
NEOEncoded
Len
()
int
{
func
(
p
*
ObjectUndoSerial
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
28
+
len
(
p
.
OidList
)
*
8
return
79
,
28
+
len
(
p
.
OidList
)
*
8
}
}
func
(
p
*
ObjectUndoSerial
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
ObjectUndoSerial
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -2896,8 +2896,8 @@ overflow:
...
@@ -2896,8 +2896,8 @@ overflow:
// 80. AnswerObjectUndoSerial
// 80. AnswerObjectUndoSerial
func
(
p
*
AnswerObjectUndoSerial
)
NEOEncoded
Len
()
int
{
func
(
p
*
AnswerObjectUndoSerial
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
4
+
len
(
p
.
ObjectTIDDict
)
*
25
return
80
,
4
+
len
(
p
.
ObjectTIDDict
)
*
25
}
}
func
(
p
*
AnswerObjectUndoSerial
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerObjectUndoSerial
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -2960,8 +2960,8 @@ overflow:
...
@@ -2960,8 +2960,8 @@ overflow:
// 81. CheckCurrentSerial
// 81. CheckCurrentSerial
func
(
p
*
CheckCurrentSerial
)
NEOEncoded
Len
()
int
{
func
(
p
*
CheckCurrentSerial
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
24
return
81
,
24
}
}
func
(
p
*
CheckCurrentSerial
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
CheckCurrentSerial
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -2985,8 +2985,8 @@ overflow:
...
@@ -2985,8 +2985,8 @@ overflow:
// 82. Pack
// 82. Pack
func
(
p
*
Pack
)
NEOEncoded
Len
()
int
{
func
(
p
*
Pack
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
8
return
8
2
,
8
}
}
func
(
p
*
Pack
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
Pack
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -3006,8 +3006,8 @@ overflow:
...
@@ -3006,8 +3006,8 @@ overflow:
// 83. AnswerPack
// 83. AnswerPack
func
(
p
*
AnswerPack
)
NEOEncoded
Len
()
int
{
func
(
p
*
AnswerPack
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
1
return
83
,
1
}
}
func
(
p
*
AnswerPack
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerPack
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -3027,8 +3027,8 @@ overflow:
...
@@ -3027,8 +3027,8 @@ overflow:
// 84. CheckReplicas
// 84. CheckReplicas
func
(
p
*
CheckReplicas
)
NEOEncoded
Len
()
int
{
func
(
p
*
CheckReplicas
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
20
+
len
(
p
.
PartitionDict
)
*
8
return
84
,
20
+
len
(
p
.
PartitionDict
)
*
8
}
}
func
(
p
*
CheckReplicas
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
CheckReplicas
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -3081,8 +3081,8 @@ overflow:
...
@@ -3081,8 +3081,8 @@ overflow:
// 85. CheckPartition
// 85. CheckPartition
func
(
p
*
CheckPartition
)
NEOEncoded
Len
()
int
{
func
(
p
*
CheckPartition
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
30
+
len
(
p
.
Source
.
UpstreamName
)
+
len
(
p
.
Source
.
Address
.
Host
)
return
85
,
30
+
len
(
p
.
Source
.
UpstreamName
)
+
len
(
p
.
Source
.
Address
.
Host
)
}
}
func
(
p
*
CheckPartition
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
CheckPartition
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -3143,8 +3143,8 @@ overflow:
...
@@ -3143,8 +3143,8 @@ overflow:
// 86. CheckTIDRange
// 86. CheckTIDRange
func
(
p
*
CheckTIDRange
)
NEOEncoded
Len
()
int
{
func
(
p
*
CheckTIDRange
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
24
return
86
,
24
}
}
func
(
p
*
CheckTIDRange
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
CheckTIDRange
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -3170,8 +3170,8 @@ overflow:
...
@@ -3170,8 +3170,8 @@ overflow:
// 87. AnswerCheckTIDRange
// 87. AnswerCheckTIDRange
func
(
p
*
AnswerCheckTIDRange
)
NEOEncoded
Len
()
int
{
func
(
p
*
AnswerCheckTIDRange
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
32
return
87
,
32
}
}
func
(
p
*
AnswerCheckTIDRange
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerCheckTIDRange
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -3195,8 +3195,8 @@ overflow:
...
@@ -3195,8 +3195,8 @@ overflow:
// 88. CheckSerialRange
// 88. CheckSerialRange
func
(
p
*
CheckSerialRange
)
NEOEncoded
Len
()
int
{
func
(
p
*
CheckSerialRange
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
32
return
88
,
32
}
}
func
(
p
*
CheckSerialRange
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
CheckSerialRange
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -3224,8 +3224,8 @@ overflow:
...
@@ -3224,8 +3224,8 @@ overflow:
// 89. AnswerCheckSerialRange
// 89. AnswerCheckSerialRange
func
(
p
*
AnswerCheckSerialRange
)
NEOEncoded
Len
()
int
{
func
(
p
*
AnswerCheckSerialRange
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
60
return
89
,
60
}
}
func
(
p
*
AnswerCheckSerialRange
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerCheckSerialRange
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -3253,8 +3253,8 @@ overflow:
...
@@ -3253,8 +3253,8 @@ overflow:
// 90. PartitionCorrupted
// 90. PartitionCorrupted
func
(
p
*
PartitionCorrupted
)
NEOEncoded
Len
()
int
{
func
(
p
*
PartitionCorrupted
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
8
+
len
(
p
.
CellList
)
*
4
return
90
,
8
+
len
(
p
.
CellList
)
*
4
}
}
func
(
p
*
PartitionCorrupted
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
PartitionCorrupted
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -3299,8 +3299,8 @@ overflow:
...
@@ -3299,8 +3299,8 @@ overflow:
// 91. LastTransaction
// 91. LastTransaction
func
(
p
*
LastTransaction
)
NEOEncoded
Len
()
int
{
func
(
p
*
LastTransaction
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
0
return
91
,
0
}
}
func
(
p
*
LastTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
LastTransaction
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -3312,8 +3312,8 @@ func (p *LastTransaction) NEODecode(data []byte) (int, error) {
...
@@ -3312,8 +3312,8 @@ func (p *LastTransaction) NEODecode(data []byte) (int, error) {
// 92. AnswerLastTransaction
// 92. AnswerLastTransaction
func
(
p
*
AnswerLastTransaction
)
NEOEncoded
Len
()
int
{
func
(
p
*
AnswerLastTransaction
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
8
return
92
,
8
}
}
func
(
p
*
AnswerLastTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerLastTransaction
)
NEOEncode
(
data
[]
byte
)
{
...
@@ -3333,8 +3333,8 @@ overflow:
...
@@ -3333,8 +3333,8 @@ overflow:
// 93. NotifyReady
// 93. NotifyReady
func
(
p
*
NotifyReady
)
NEOEncoded
Len
()
int
{
func
(
p
*
NotifyReady
)
NEOEncoded
Info
()
(
uint16
,
int
)
{
return
0
return
93
,
0
}
}
func
(
p
*
NotifyReady
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
NotifyReady
)
NEOEncode
(
data
[]
byte
)
{
...
...
go/neo/proto.go
View file @
c4ba3f34
...
@@ -91,11 +91,13 @@ var ErrDecodeOverflow = errors.New("decode: bufer overflow")
...
@@ -91,11 +91,13 @@ var ErrDecodeOverflow = errors.New("decode: bufer overflow")
// NEOEncoder is interface for marshaling objects to wire format
// NEOEncoder is interface for marshaling objects to wire format
type
NEOEncoder
interface
{
type
NEOEncoder
interface
{
// compute how much space is needed to encode
// NEOEncodedInfo returns message code needed to be used for the packet
NEOEncodedLen
()
int
// on the wire and how much space is needed to encode payload
// XXX naming?
NEOEncodedInfo
()
(
msgCode
uint16
,
payloadLen
int
)
// perform the encoding.
// perform the encoding.
// len(buf) must be >=
NEOEncodedLen()
// len(buf) must be >=
payloadLen returned by NEOEncodedInfo
NEOEncode
(
buf
[]
byte
)
NEOEncode
(
buf
[]
byte
)
}
}
...
...
go/neo/proto_test.go
View file @
c4ba3f34
...
@@ -82,7 +82,11 @@ func testPktMarshal(t *testing.T, pkt NEOCodec, encoded string) {
...
@@ -82,7 +82,11 @@ func testPktMarshal(t *testing.T, pkt NEOCodec, encoded string) {
}()
}()
// pkt.encode() == expected
// pkt.encode() == expected
n
:=
pkt
.
NEOEncodedLen
()
msgCode
,
n
:=
pkt
.
NEOEncodedInfo
()
msgType
:=
pktTypeRegistry
[
msgCode
]
if
msgType
!=
typ
{
t
.
Errorf
(
"%v: msgCode = %v which corresponds to %v"
,
typ
,
msgCode
,
msgType
)
}
if
n
!=
len
(
encoded
)
{
if
n
!=
len
(
encoded
)
{
t
.
Errorf
(
"%v: encodedLen = %v ; want %v"
,
typ
,
n
,
len
(
encoded
))
t
.
Errorf
(
"%v: encodedLen = %v ; want %v"
,
typ
,
n
,
len
(
encoded
))
}
}
...
@@ -266,7 +270,7 @@ func TestPktMarshalAllOverflowLightly(t *testing.T) {
...
@@ -266,7 +270,7 @@ func TestPktMarshalAllOverflowLightly(t *testing.T) {
for
_
,
typ
:=
range
pktTypeRegistry
{
for
_
,
typ
:=
range
pktTypeRegistry
{
// zero-value for a type
// zero-value for a type
pkt
:=
reflect
.
New
(
typ
)
.
Interface
()
.
(
NEOCodec
)
pkt
:=
reflect
.
New
(
typ
)
.
Interface
()
.
(
NEOCodec
)
l
:=
pkt
.
NEOEncodedLen
()
_
,
l
:=
pkt
.
NEOEncodedInfo
()
zerol
:=
make
([]
byte
,
l
)
zerol
:=
make
([]
byte
,
l
)
// decoding will turn nil slice & map into empty allocated ones.
// decoding will turn nil slice & map into empty allocated ones.
// we need it so that reflect.DeepEqual works for pkt encode/decode comparison
// we need it so that reflect.DeepEqual works for pkt encode/decode comparison
...
...
go/neo/protogen.go
View file @
c4ba3f34
...
@@ -19,7 +19,7 @@ This program generates marshalling code for packet types defined in proto.go .
...
@@ -19,7 +19,7 @@ This program generates marshalling code for packet types defined in proto.go .
For every type 3 methods are generated in accordance with NEOEncoder and
For every type 3 methods are generated in accordance with NEOEncoder and
NEODecoder interfaces:
NEODecoder interfaces:
NEOEncoded
Len() int
NEOEncoded
Info() (msgCode uint16, payloadLen int)
NEOEncode(buf []byte)
NEOEncode(buf []byte)
NEODecode(data []byte) (nread int, err error)
NEODecode(data []byte) (nread int, err error)
...
@@ -192,7 +192,7 @@ import (
...
@@ -192,7 +192,7 @@ import (
case
*
ast
.
StructType
:
case
*
ast
.
StructType
:
fmt
.
Fprintf
(
&
buf
,
"// %d. %s
\n\n
"
,
pktCode
,
typename
)
fmt
.
Fprintf
(
&
buf
,
"// %d. %s
\n\n
"
,
pktCode
,
typename
)
buf
.
WriteString
(
generateCodecCode
(
typespec
,
&
sizer
{}))
buf
.
WriteString
(
generateCodecCode
(
typespec
,
&
sizer
{
msgCode
:
pktCode
}))
buf
.
WriteString
(
generateCodecCode
(
typespec
,
&
encoder
{}))
buf
.
WriteString
(
generateCodecCode
(
typespec
,
&
encoder
{}))
buf
.
WriteString
(
generateCodecCode
(
typespec
,
&
decoder
{}))
buf
.
WriteString
(
generateCodecCode
(
typespec
,
&
decoder
{}))
...
@@ -455,13 +455,18 @@ func (o *OverflowCheck) AddExpr(format string, a ...interface{}) {
...
@@ -455,13 +455,18 @@ func (o *OverflowCheck) AddExpr(format string, a ...interface{}) {
type
sizer
struct
{
type
sizer
struct
{
commonCodeGen
commonCodeGen
size
SymSize
// currently accumulated packet size
size
SymSize
// currently accumulated packet size
// which code to also return as packet msgCode
// (sizer does not compute this - it is emitted as-is given by caller)
msgCode
int
}
}
// encoder generates code to encode a packet
// encoder generates code to encode a packet
//
//
// when type is recursively walked, for every case code to update `data[n:]` is generated.
// when type is recursively walked, for every case code to update `data[n:]` is generated.
// no overflow checks are generated as by NEOEncoder interface provided data
// no overflow checks are generated as by NEOEncoder interface provided data
// buffer should have at least NEOEncodedLen() length (the size computed by sizer).
// buffer should have at least payloadLen length returned by NEOEncodedInfo()
// (the size computed by sizer).
//
//
// the code emitted looks like:
// the code emitted looks like:
//
//
...
@@ -517,7 +522,7 @@ var _ CodeGenerator = (*decoder)(nil)
...
@@ -517,7 +522,7 @@ var _ CodeGenerator = (*decoder)(nil)
func
(
s
*
sizer
)
generatedCode
()
string
{
func
(
s
*
sizer
)
generatedCode
()
string
{
code
:=
Buffer
{}
code
:=
Buffer
{}
// prologue
// prologue
code
.
emit
(
"func (%s *%s) NEOEncoded
Len() int
{"
,
s
.
recvName
,
s
.
typeName
)
code
.
emit
(
"func (%s *%s) NEOEncoded
Info() (uint16, int)
{"
,
s
.
recvName
,
s
.
typeName
)
if
s
.
varUsed
[
"size"
]
{
if
s
.
varUsed
[
"size"
]
{
code
.
emit
(
"var %s int"
,
s
.
var_
(
"size"
))
code
.
emit
(
"var %s int"
,
s
.
var_
(
"size"
))
}
}
...
@@ -529,7 +534,7 @@ func (s *sizer) generatedCode() string {
...
@@ -529,7 +534,7 @@ func (s *sizer) generatedCode() string {
if
s
.
varUsed
[
"size"
]
{
if
s
.
varUsed
[
"size"
]
{
size
+=
" + "
+
s
.
var_
(
"size"
)
size
+=
" + "
+
s
.
var_
(
"size"
)
}
}
code
.
emit
(
"return %v
"
,
size
)
code
.
emit
(
"return %v
, %v"
,
s
.
msgCode
,
size
)
code
.
emit
(
"}
\n
"
)
code
.
emit
(
"}
\n
"
)
return
code
.
String
()
return
code
.
String
()
...
...
go/neo/storage.go
View file @
c4ba3f34
...
@@ -126,8 +126,13 @@ func RecvAndDecode(conn *Conn) (interface{}, error) { // XXX interface{} -> NEOD
...
@@ -126,8 +126,13 @@ func RecvAndDecode(conn *Conn) (interface{}, error) { // XXX interface{} -> NEOD
func
EncodeAndSend
(
conn
*
Conn
,
pkt
NEOEncoder
)
error
{
func
EncodeAndSend
(
conn
*
Conn
,
pkt
NEOEncoder
)
error
{
// TODO encode pkt
// TODO encode pkt
l
:=
pkt
.
NEOEncodedLen
()
msgCode
,
l
:=
pkt
.
NEOEncodedInfo
()
buf
:=
PktBuf
{
make
([]
byte
,
PktHeadLen
+
l
)}
// XXX -> freelist
l
+=
PktHeadLen
buf
:=
PktBuf
{
make
([]
byte
,
l
)}
// XXX -> freelist
h
:=
buf
.
Header
()
h
.
MsgCode
=
hton16
(
msgCode
)
h
.
Len
=
hton32
(
uint32
(
l
))
// XXX casting: think again
pkt
.
NEOEncode
(
buf
.
Payload
())
pkt
.
NEOEncode
(
buf
.
Payload
())
return
conn
.
Send
(
&
buf
)
// XXX why pointer?
return
conn
.
Send
(
&
buf
)
// XXX why pointer?
...
...
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