File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -230,7 +230,9 @@ func ParseAddr(addr string) (*Address, error) {
230
230
if err != nil {
231
231
return nil , err
232
232
}
233
-
233
+ return ParseBytes (data )
234
+ }
235
+ func ParseAddr (data []byte ) (* Address , error ) {
234
236
if len (data ) != 36 {
235
237
return nil , errors .New ("incorrect address data" )
236
238
}
@@ -267,10 +269,10 @@ func ParseRawAddr(addr string) (*Address, error) {
267
269
}
268
270
269
271
func (a * Address ) Checksum () uint16 {
270
- return crc16 .Checksum (a .prepareChecksumData (), crc16 .MakeTable (crc16 .CRC16_XMODEM ))
272
+ return crc16 .Checksum (a .Bytes (), crc16 .MakeTable (crc16 .CRC16_XMODEM ))
271
273
}
272
274
273
- func (a * Address ) prepareChecksumData () []byte {
275
+ func (a * Address ) Bytes () []byte {
274
276
var data [34 ]byte
275
277
data [0 ] = a .FlagsToByte ()
276
278
data [1 ] = byte (a .workchain )
Original file line number Diff line number Diff line change @@ -334,7 +334,7 @@ func TestAddress_Workchain(t *testing.T) {
334
334
}
335
335
}
336
336
337
- func TestAddress_prepareChecksumData (t * testing.T ) {
337
+ func TestAddress_Bytes (t * testing.T ) {
338
338
type fields struct {
339
339
flags flags
340
340
workchain int32
@@ -357,8 +357,8 @@ func TestAddress_prepareChecksumData(t *testing.T) {
357
357
workchain : tt .fields .workchain ,
358
358
data : tt .fields .data ,
359
359
}
360
- if got := a .prepareChecksumData (); ! reflect .DeepEqual (got , tt .want ) {
361
- t .Errorf ("prepareChecksumData () = %v, want %v" , got , tt .want )
360
+ if got := a .Bytes (); ! reflect .DeepEqual (got , tt .want ) {
361
+ t .Errorf ("Bytes () = %v, want %v" , got , tt .want )
362
362
}
363
363
})
364
364
}
You can’t perform that action at this time.
0 commit comments