While working on the raw transactions for atomic name trading, I stumbled across the situation that change from name_update operations is sent to pubkeys not addresses (pubkey hash). Usually, addresses should be preferred, because they provide additional protection of the output offered by the hashing (for the unlikely case that ECDSA is broken and if the address is not reused, also a preimage attack on the hashing would need to be found in order to steal the funds).
I think this is due to the code around namecoin.cpp:349:
Code: Select all
// -------------- Fill a vout to ourself, using same address type as the payment
// Now sending always to hash160 (GetBitcoinAddressHash160 will return hash160, even if pubkey is used)
CScript scriptChange;
if (vecSend[0].first.GetBitcoinAddressHash160() != 0)
scriptChange.SetBitcoinAddress(vchPubKey);
else
scriptChange << vchPubKey << OP_CHECKSIG;
vecSend[0] is the transaction output containing the OP_NAME_UPDATE, for which GetBitcoinAddress() fails since it doesn't handle the preceding name operation properly. Thus always the "else" branch is executed, resulting in send-to-pubkey. Is there a reason why we do not simply always send to the address as in the "if" branch? I think that should be fine.
BTC: 1
domobKsPZ5cWk2kXssD8p8ES1qffGUCm | NMC: NC
domobcmcmVdxC5yxMitojQ4tvAtv99pY
BM-GtQnWM3vcdorfqpKXsmfHQ4rVYPG5pKS
Use your Namecoin identity as OpenID:
https://nameid.org/