public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
From: Chris Double <chris.double@double•co.nz>
To: bitcoin-development@lists•sourceforge.net
Subject: [Bitcoin-development] Transaction limit size in CWallet::CreateTransaction
Date: Sun, 4 Sep 2011 01:52:19 +1200	[thread overview]
Message-ID: <CALn1vHHynfb-u8fSwsStA=e5vR6x-e3yA44Z9Mt9A+AgO1+ezQ@mail.gmail.com> (raw)

In CWallet::CreateTransaction there is a call to 'GetSerializeSize' on
line 979 (https://github.com/bitcoin/bitcoin/blob/master/src/wallet.cpp#L979).
It looks like:

---------8<----------
unsigned int nBytes = ::GetSerializeSize(*(CTransaction*)&wtxNew, SER_NETWORK)
if (nBytes >= MAX_BLOCK_SIZE_GEN/5)
  return false;
dPriority /= nBytes;
---------8<----------

'wtxNew' is a CWalletTxn. So this gets the serialized size of the
transaction, including all the extra data held in the wallet for that
transaction, and uses that size for computation of priority. Is that
correct? Should it be only the size of the CTransaction* part of the
transaction that should be used?

It looks this was from the casting shenanigans but unless I'm
mistaken, that casting doesn't actually do anything. We get a pointer
to a CTransaction but then dereference it, so the template function
'GetSerializeSize' would get the most derived class, right?

So was the intent to use the CWalletTxn size, and the casting is
superfluous, or was it supposed to be the CTransaction* portion and
the cast is an incorrect way of doing that? Or am I suffering from
late night programmer syndrome and reading it wrong?

Chris.
-- 
http://www.bluishcoder.co.nz



             reply	other threads:[~2011-09-03 13:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-03 13:52 Chris Double [this message]
2011-09-03 14:16 ` Chris Double

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALn1vHHynfb-u8fSwsStA=e5vR6x-e3yA44Z9Mt9A+AgO1+ezQ@mail.gmail.com' \
    --to=chris.double@double$(echo .)co.nz \
    --cc=bitcoin-development@lists$(echo .)sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox