@@ -618,3 +618,90 @@ func TestChainProperties_UnmarshalJSON_POWOperation(t *testing.T) {
618618 t .Errorf ("expected AccountCreationFee to be '100.000 STEEM', got '%s'" , op .Props .AccountCreationFee )
619619 }
620620}
621+
622+ func TestPOWOperation_UnmarshalJSON_LargeNonce (t * testing.T ) {
623+ // Test that large nonce values (beyond int64 range) can be parsed correctly
624+ // This is based on the actual data from block 64500
625+ jsonData := `{
626+ "worker_account": "sminer47",
627+ "block_id": "0000fbf357840bfa4e52b569a0498edb20efbe0c",
628+ "nonce": "11115213149964598312",
629+ "work": {
630+ "worker": "STM6tC4qRjUPKmkqkug5DvSgkeND5DHhnfr3XTgpp4b4nejMEwn9k",
631+ "input": "d29c469c89252a297cb22c949268593c7c6dcf012c836ce004bf04f7922d1405",
632+ "signature": "1fcc715d38c35fcb35dcce0056e770419d5f327c64b2583ba2e8cc7951de6fb0d562b7d6258d5fff41725edd987b2b91cb7c42c9a24eac84c4a393930ec318f3e2",
633+ "work": "000000054cbe98830fff5628cb2f9f0464812cf117c55e30e1e0f9d3ac7ef5c2"
634+ },
635+ "props": {
636+ "account_creation_fee": "100.000 STEEM",
637+ "maximum_block_size": 131072,
638+ "sbd_interest_rate": 1000
639+ }
640+ }`
641+
642+ var op POWOperation
643+ if err := json .Unmarshal ([]byte (jsonData ), & op ); err != nil {
644+ t .Fatalf ("Failed to unmarshal POWOperation with large nonce: %v" , err )
645+ }
646+
647+ // Verify the operation was parsed correctly
648+ if op .WorkerAccount != "sminer47" {
649+ t .Errorf ("expected worker_account 'sminer47', got %v" , op .WorkerAccount )
650+ }
651+
652+ if op .BlockID != "0000fbf357840bfa4e52b569a0498edb20efbe0c" {
653+ t .Errorf ("expected block_id '0000fbf357840bfa4e52b569a0498edb20efbe0c', got %v" , op .BlockID )
654+ }
655+
656+ // Verify the large nonce value was parsed correctly
657+ if op .Nonce == nil {
658+ t .Fatal ("expected nonce to be non-nil" )
659+ }
660+
661+ expectedNonce := UInt64 (11115213149964598312 )
662+ if * op .Nonce != expectedNonce {
663+ t .Errorf ("expected nonce %v, got %v" , expectedNonce , * op .Nonce )
664+ }
665+
666+ // Verify work was parsed
667+ if op .Work == nil {
668+ t .Fatal ("expected work to be non-nil" )
669+ }
670+
671+ if op .Work .Worker != "STM6tC4qRjUPKmkqkug5DvSgkeND5DHhnfr3XTgpp4b4nejMEwn9k" {
672+ t .Errorf ("expected work.worker 'STM6tC4qRjUPKmkqkug5DvSgkeND5DHhnfr3XTgpp4b4nejMEwn9k', got %v" , op .Work .Worker )
673+ }
674+
675+ // Verify props were parsed
676+ if op .Props == nil {
677+ t .Fatal ("expected props to be non-nil" )
678+ }
679+
680+ if op .Props .MaximumBlockSize != 131072 {
681+ t .Errorf ("expected maximum_block_size 131072, got %v" , op .Props .MaximumBlockSize )
682+ }
683+ }
684+
685+ func TestPOWOperation_Type (t * testing.T ) {
686+ nonce := UInt64 (12345 )
687+ op := & POWOperation {
688+ WorkerAccount : "worker" ,
689+ BlockID : "block_id" ,
690+ Nonce : & nonce ,
691+ Work : & POW {
692+ Worker : "STM..." ,
693+ Input : "input" ,
694+ Signature : "sig" ,
695+ Work : "work" ,
696+ },
697+ Props : & ChainProperties {
698+ AccountCreationFee : "0.100 STEEM" ,
699+ MaximumBlockSize : 65536 ,
700+ SBDInterestRate : 1000 ,
701+ },
702+ }
703+
704+ if op .Type () != TypePOW {
705+ t .Errorf ("expected TypePOW, got %v" , op .Type ())
706+ }
707+ }
0 commit comments