There is absolutely no reason trying to broadcast invalid transaction.
It is wasting your time and your traffic.
Your peer(s) will check it and throw it away. They will not relay it to network.
They also can ban your IP-address for some time (1 day?)
May be you want to send valid but non-standard transaction?
Or may be you want to have a custom tool, which sends transactions to a network?
// [...]
void NetSocket::pushTx ( const QByteArray& data )
{
const MyKey32 key ( data.constData ( ), data.size ( ) ); // calculate txid
outTx.insert ( key, data ); // store data
write ( "inv", invPacket ( MSG_TX, key ) ); // send inv packet
}
//--------------------------------------------------------------
void NetSocket::write ( const char* type, const QByteArray& data )
{
socket -> write ( packet ( type, data ) );
}
//--------------------------------------------------------------
void NetSocket::procGetdataPacket ( const QByteArray& data )
{
Stream d ( data ); d.skip24 ( ); // i do not check header now
const int count ( d.readVar ( ) );
xassert ( count == 1 );
const quint8* ss = d.readAdvance ( 36 );
const quint32 tag ( *(quint32*)ss );
const MyKey32 key ( ss + 4 );
xassert ( tag == MSG_TX );
xassert ( outTx.contains ( key ) );
write ( "tx", txPacket ( outTx.value ( key ) ) );
}
// [...]