Do transactions and blocks get relayed even if a node believes them to be invalid?

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?

cdecker

Posted 2012-09-12T15:35:19.943

Reputation: 7 878

Answers

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

Posted 2012-09-12T15:35:19.943

Reputation: 26 118

@PieterWuille, Doesn't this depend on the client? What's stopping a rogue client from relaying invalid blocks?Pacerier 2014-05-22T20:43:39.787

Nothing. Which is why everyone else who cares verifies them :)Pieter Wuille 2014-05-22T21:49:22.673

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 2012-09-13T03:08:36.857