steem icon indicating copy to clipboard operation
steem copied to clipboard

Calling steem.api.getBlock for new block returns block which is not added to blockchain

Open BartolomeoItaliano opened this issue 4 years ago • 7 comments

If I call steem.api.getBlock(blockNuber) for a newly created block it returns sometimes block similar to this one (I removed part of block cause github doesn't allow such long messages):

{
  "previous": "028b258410bed2716b5fdcb2f1b6b0df78a6a4ab",
  "timestamp": "2020-04-19T20:58:12",
  "witness": "abit",
  "transaction_merkle_root": "86296ea490e7cbdc10f84cf1ff06b4baf920303b",
  "extensions": [],
  "witness_signature": "207d6977c8de3871ab032237c3eb890e6c05e1ff61a244e91385cecb48844b66fe19c5258b019305bcdee825aeb0d0b504989396150f44e63cc7ac5f9a383ba752",
  "transactions": [
    {
      "ref_block_num": 8439,
      "ref_block_prefix": 1328513576,
      "expiration": "2020-04-19T20:58:15",
      "operations": [
        [
          "transfer",
          {
            "from": "gtg",
            "to": "gandalf",
            "amount": "0.001 SBD",
            "memo": "are malicious witnesses are still holding my funds hostage? collecting proofs."
          }
        ]
      ],
      "extensions": [],
      "signatures": [
        "1f02e24ff3c29e25390b3a02a6b6ea98892631474ee8900d9b712114641fbf858a17613941cca71a1e614aba154c92c208af2a554f01ed695a5de5060d2674fc56"
      ],
      "transaction_id": "626c5269146ac543afb7a82339195ef81b43186e",
      "block_num": 42673541,
      "transaction_num": 0
    },
    {
      "ref_block_num": 8440,
      "ref_block_prefix": 1475027636,
      "expiration": "2020-04-19T20:58:17",
      "operations": [
        [
          "transfer",
          {
            "from": "gandalf",
            "to": "steem.chat",
            "amount": "0.001 SBD",
            "memo": "Are malicious witnesses affecting reliability of transfers on the Steem network? Collecting proofs."
          }
        ]
      ],
      "extensions": [],
      "signatures": [
        "20594194258f51ff9de16b05ce792d36dc8312dfc9636f1afe50714f3c87b5894b6b5ba4c51dc9b83aaa4b15718755297f5c0c304054c6ec7bdcea8822ad464cce"
      ],
      "transaction_id": "8152caf655126877009a92e80fb27f601ef6d258",
      "block_num": 42673541,
      "transaction_num": 1
    },
    {
      "ref_block_num": 8913,
      "ref_block_prefix": 1619027594,
      "expiration": "2020-04-19T21:22:39",
      "operations": [
        [
          "transfer",
          {
            "from": "gandalf",
            "to": "steem.chat",
            "amount": "0.001 SBD",
            "memo": "Are malicious witnesses affecting reliability of transfers on the Steem network? Collecting proofs."
          }
        ]
      ],
      "extensions": [],
      "signatures": [
        "2023e0aec80e66ed004526e945d5d0610bdee9f3cad200c23608cf45c52a1eb08b2d2a37012b7c583647f65ca046d32358a1c2a27fbf8be6f214919d5b2973b150"
      ],
      "transaction_id": "b5cd79fcf8d7e692a4b061bc4f026f0b1ad8f6e4",
      "block_num": 42673541,
      "transaction_num": 325
    },
    {
      "ref_block_num": 8915,
      "ref_block_prefix": 2641836516,
      "expiration": "2020-04-19T21:22:47",
      "operations": [
        [
          "transfer",
          {
            "from": "gtg",
            "to": "gandalf",
            "amount": "0.001 SBD",
            "memo": "are malicious witnesses are still holding my funds hostage? collecting proofs."
          }
        ]
      ],
      "extensions": [],
      "signatures": [
        "1f2f17c5e9d7690d17be62e4718d6f20232ef6f81b650652955c5b857ba832d98b08e04b2cf3876effbbe8320b5238c49a355c54f69f46ac39f5443ac8ca355315"
      ],
      "transaction_id": "01afe1af13789028ff1ba83485a8f8d50c749863",
      "block_num": 42673541,
      "transaction_num": 326
    }
  ],
  "block_id": "028b2585ae43ebee8fdc6764fdd7d2e9f0d042ea",
  "signing_key": "STM6KNYPwdsFjvvJATBYYk2qaXB9gKWTfbLUf52EcYAGejuWijdnk"
}

If call:

steem.api.getBlock(blockNuber)

few seconds later I receive different block.

I think, it's critical bug, please fix this.

`

BartolomeoItaliano avatar Apr 25 '20 16:04 BartolomeoItaliano

can you share the detailed commands?

Benson0224 avatar May 06 '20 02:05 Benson0224

Some of the witnesses are reversing blocks (bad practice).

mys avatar May 06 '20 05:05 mys

it should be caused by various witnesses running different versions and this is causing microforks. a major version hard fork is on a discussion which would ensure all witnesses would be running the same version. we will keep monitoring this issue.

Benson0224 avatar May 06 '20 09:05 Benson0224

Some of the witnesses are reversing blocks (bad practice).

Yes, that's exactly what I think I experience.

Is there a way to ensure I read block which will not be reversed? I want to be sure such situations cannot happen.

BartolomeoItaliano avatar May 06 '20 10:05 BartolomeoItaliano

Some of the witnesses are reversing blocks (bad practice).

Some of the witnesses blocking users funds (bad practice)

VIM-Arcange avatar May 06 '20 11:05 VIM-Arcange

Is there a way to ensure I read block which will not be reversed?

Just use the last_irreversible_block_num from the get_dynamic_global_properties result.

steemchiller avatar May 12 '20 09:05 steemchiller

Just use the last_irreversible_block_num from the get_dynamic_global_properties result.

This is true unless witness fork a chain from before last_irreversible_block_num. I believe this happens much on Steem last days creating mini-forks.

mys avatar May 12 '20 21:05 mys