These flags are confusing :(
Yes! :frowning_face:
Indeed, having fRelay=false I think is not currently compatible with reconciliations.
I guess you mean the relay flag in the either VERSION message - sent or received, right?
What about clarifying the BIP:
0-sendtxrcncl ... Must not be sent if peer specified no support for transaction relay (fRelay=0) in "version". Otherwise, the sender should be disconnected.
1+sendtxrcncl ... Must not be sent if either peer specified no support for transaction relay (fRelay=0) in "version". Otherwise, the sender should be disconnected.
So, instead of GetTxRelay(), we better look at pfrom.m_relays_txs, right?
Yes, this is closer to checking whether the peer sent us relay=false in VERSION. However it is not identical - fRelay may be true, but pfrom.m_relays_txs be false if pfrom.IsBlockOnlyConn(). It is ok to accept this discrepancy because for block-only connections we sent relay=false in our VERSION message.
That said, maybe the condition should be:
0-if (!peer->GetTxRelay() || m_ignore_incoming_txs) {
1+if (!pfrom.m_relays_txs /* they sent relay=false */ ||
2+ RejectIncomingTxs(pfrom) /* we sent relay=false */) {