FactomProject / factom

Library for writing Factom clients in go
MIT License
44 stars 19 forks source link

GetCurrentMinute(): Unmarshal number into Go struct field CurrentMinuteInfo.currenttime of type int64 #110

Closed ilzheev closed 5 years ago

ilzheev commented 5 years ago

I try to run pegnet oracleMiner and meet an issue while using factom lib:

f.info, err = factom.GetCurrentMinute()

err:

ERRO[0006] json: cannot unmarshal number 1.5608661075125e+18 into Go struct field CurrentMinuteInfo.currenttime of type int64

Debugging inside GetCurrentMinute() function shows, that factomd request is successful, but failed to unmarshal it:

INFO[0000] {"jsonrpc":"2.0","id":3,"result":{"stalldetected":false,"minute":2,"leaderheight":197528,"currentminutestarttime":1.5608669407298e+18,"directoryblockinseconds":600,"directoryblockheight":197528,"currenttime":1.5608669649873e+18,"currentblockstarttime":1.5608668208451e+18}} 
Emyrk commented 5 years ago

This is using the v1-rollup branch

Emyrk commented 5 years ago

Being tracked under FD-1061

Emyrk commented 5 years ago

@ilzheev I assume you are using opennode?

factomd formats the response as

{"jsonrpc":"2.0","id":1,"result":{"leaderheight":53,"directoryblockheight":53,"minute":5,"currentblockstarttime":1560898027818516037,"currentminutestarttime":1560898030812850661,"currenttime":1560898030958351884,"directoryblockinseconds":6,"stalldetected":false,"faulttimeout":120,"roundtimeout":30}}

Specifically, it does not make it 1.5608661075125e+18.

Emyrk commented 5 years ago

Looks like an issue in OpenNode proxy

Emyrk commented 5 years ago

Closing as this is an error as the result of a proxy decoding and re-encoding the response with a different number format