5

Each node has a very clear view of what is valid and what is not. With conflicting blocks (Blockchain fork) or transactions (double-spending attack) it will always choose the first it sees, until it gets prove otherwise (longer blockchain or other transaction is included in a block).

I'm wondering whether the Satoshi Client relays any of the transactions or blocks he thinks are not valid. So will I ever see a transaction if all my neighbors have seen a conflicting transaction first? Will I see forked blocks if all my neighbors agree on which block came first?

D.H.
  • 5,307
  • 3
  • 32
  • 45
cdecker
  • 9,498
  • 1
  • 39
  • 61

1 Answers1

4

A block is valid only if it obeys all the protocol rules. If it is invalid, it will not be relayed:

Now the client does maintain side chains. So if there is the main branch and a side branch, even though the node included a transaction in the main branch doesn't mean it will reject a block for the side branch just because it too contains the same transaction. So for each branch it is determined if that block was valid or not.

But there is a rule that valid blocks are only relayed if they are added to the (new) main branch / best known chain (thanks to Pieter for the correction).

As far as a new transaction being relayed - if it is invalid for the main branch (e.g., double spend) then it will not be relayed by the node.

So a transaction is either already in a block in the main branch already (and thus would be rejected if it is a double spend) or it isn't in the main branch and will as a result always be relayed.

This will be relayed even if that transaction is already included in a block in the side chain.

Stephen Gornick
  • 27,040
  • 12
  • 67
  • 141
  • Almost correct. Only valid blocks and transactions are relayed, but for blocks there is another rule: they're only relayed if they are part of the (new) best known chain. Relaying blocks in sidechains is usually a waste of work anyway. – Pieter Wuille Sep 13 '12 at 03:08
  • @PieterWuille, Doesn't this depend on the client? What's stopping a rogue client from relaying invalid blocks? – Pacerier May 22 '14 at 20:43
  • Nothing. Which is why everyone else who cares verifies them :) – Pieter Wuille May 22 '14 at 21:49