}\r
}\r
\r
- explicit CBigNum(const std::string& str)\r
- {\r
- BN_init(this);\r
- SetHex(str);\r
- }\r
-\r
CBigNum& operator=(const CBigNum& b)\r
{\r
if (!BN_copy(this, &b))\r
\r
CBigNum& operator>>=(unsigned int shift)\r
{\r
+ // Note: BN_rshift segfaults on 64-bit ubuntu 9.10 if 2^shift is greater than the number\r
if (!BN_rshift(this, this, shift))\r
throw bignum_error("CBigNum:operator>>= : BN_rshift failed");\r
return *this;\r
inline const CBigNum operator>>(const CBigNum& a, unsigned int shift)\r
{\r
CBigNum r;\r
+ // Note: BN_rshift segfaults on 64-bit ubuntu 9.10 if 2^shift is greater than the number\r
if (!BN_rshift(&r, &a, shift))\r
throw bignum_error("CBigNum:operator>> : BN_rshift failed");\r
return r;\r
txNew.vout.resize(1);\r
txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));\r
txNew.vout[0].nValue = 50 * COIN;\r
- txNew.vout[0].scriptPubKey = CScript() << CBigNum("0x5F1DF16B2B704C8A578D0BBAF74D385CDE12C11EE50455F3C438EF4C3FBCF649B6DE611FEAE06279A60939E028A8D65C10B73071A6F16719274855FEB0FD8A6704") << OP_CHECKSIG;\r
+ CBigNum bnPubKey;\r
+ bnPubKey.SetHex("0x5F1DF16B2B704C8A578D0BBAF74D385CDE12C11EE50455F3C438EF4C3FBCF649B6DE611FEAE06279A60939E028A8D65C10B73071A6F16719274855FEB0FD8A6704");\r
+ txNew.vout[0].scriptPubKey = CScript() << bnPubKey << OP_CHECKSIG;\r
CBlock block;\r
block.vtx.push_back(txNew);\r
block.hashPrevBlock = 0;\r
return "You don't have enough money";\r
\r
// Parse bitcoin address\r
- uint160 hash160;\r
- if (!AddressToHash160(strAddress, hash160))\r
+ CScript scriptPubKey;\r
+ if (!scriptPubKey.SetBitcoinAddress(strAddress))\r
return "Invalid bitcoin address";\r
\r
- // Send to bitcoin address\r
- CScript scriptPubKey;\r
- scriptPubKey.SetBitcoinAddress(hash160);\r
return SendMoney(scriptPubKey, nValue, wtxNew);\r
}\r
{\r
printf("ThreadMessageHandler started\n");\r
SetThreadPriority(THREAD_PRIORITY_BELOW_NORMAL);\r
- loop\r
+ while (!fShutdown)\r
{\r
// Poll the connected nodes for messages\r
vector<CNode*> vNodesCopy;\r
// Connect to localhost\r
tcp::iostream stream("127.0.0.1", "8332");\r
if (stream.fail())\r
- throw runtime_error("unable to connect to server");\r
+ throw runtime_error("couldn't connect to server");\r
\r
// Send request\r
string strRequest = JSONRPCRequest(strMethod, params, 1);\r
m_toolBar->Realize();\r
// resize to fit ubuntu's huge default font\r
dResize = 1.20;\r
- SetSize(dResize * GetSize().GetWidth(), 1.1 * GetSize().GetHeight());\r
+ SetSize((dResize + 0.02) * GetSize().GetWidth(), 1.09 * GetSize().GetHeight());\r
#endif\r
m_staticTextBalance->SetLabel(FormatMoney(GetBalance()) + " ");\r
m_listCtrl->SetFocus();\r
m_listCtrl->InsertColumn(5, "Debit", wxLIST_FORMAT_RIGHT, dResize * 79);\r
m_listCtrl->InsertColumn(6, "Credit", wxLIST_FORMAT_RIGHT, dResize * 79);\r
\r
- //m_listCtrlProductsSent->InsertColumn(0, "Category", wxLIST_FORMAT_LEFT, 100);\r
- //m_listCtrlProductsSent->InsertColumn(1, "Title", wxLIST_FORMAT_LEFT, 100);\r
- //m_listCtrlProductsSent->InsertColumn(2, "Description", wxLIST_FORMAT_LEFT, 100);\r
- //m_listCtrlProductsSent->InsertColumn(3, "Price", wxLIST_FORMAT_LEFT, 100);\r
- //m_listCtrlProductsSent->InsertColumn(4, "", wxLIST_FORMAT_LEFT, 100);\r
-\r
- //m_listCtrlOrdersSent->InsertColumn(0, "Time", wxLIST_FORMAT_LEFT, 100);\r
- //m_listCtrlOrdersSent->InsertColumn(1, "Price", wxLIST_FORMAT_LEFT, 100);\r
- //m_listCtrlOrdersSent->InsertColumn(2, "", wxLIST_FORMAT_LEFT, 100);\r
- //m_listCtrlOrdersSent->InsertColumn(3, "", wxLIST_FORMAT_LEFT, 100);\r
- //m_listCtrlOrdersSent->InsertColumn(4, "", wxLIST_FORMAT_LEFT, 100);\r
-\r
- //m_listCtrlOrdersReceived->InsertColumn(0, "Time", wxLIST_FORMAT_LEFT, 100);\r
- //m_listCtrlOrdersReceived->InsertColumn(1, "Price", wxLIST_FORMAT_LEFT, 100);\r
- //m_listCtrlOrdersReceived->InsertColumn(2, "Payment Status", wxLIST_FORMAT_LEFT, 100);\r
- //m_listCtrlOrdersReceived->InsertColumn(3, "", wxLIST_FORMAT_LEFT, 100);\r
- //m_listCtrlOrdersReceived->InsertColumn(4, "", wxLIST_FORMAT_LEFT, 100);\r
-\r
// Init status bar\r
int pnWidths[3] = { -100, 88, 290 };\r
#ifndef __WXMSW__\r
\r
void CMainFrame::InsertLine(bool fNew, int nIndex, uint256 hashKey, string strSort, const wxString& str2, const wxString& str3, const wxString& str4, const wxString& str5, const wxString& str6)\r
{\r
- string str0 = strSort;\r
- long nData = *(long*)&hashKey;\r
+ strSort = " " + strSort; // leading space to workaround wx2.9.0 ubuntu 9.10 bug\r
+ long nData = *(long*)&hashKey; // where first char of hidden column is displayed\r
\r
// Find item\r
if (!fNew && nIndex == -1)\r
{\r
+ string strHash = " " + hashKey.ToString();\r
while ((nIndex = m_listCtrl->FindItem(nIndex, nData)) != -1)\r
- if (GetItemText(m_listCtrl, nIndex, 1) == hashKey.ToString())\r
+ if (GetItemText(m_listCtrl, nIndex, 1) == strHash)\r
break;\r
}\r
\r
// fNew is for blind insert, only use if you're sure it's new\r
if (fNew || nIndex == -1)\r
{\r
- nIndex = m_listCtrl->InsertItem(GetSortIndex(strSort), str0);\r
+ nIndex = m_listCtrl->InsertItem(GetSortIndex(strSort), strSort);\r
}\r
else\r
{\r
// If sort key changed, must delete and reinsert to make it relocate\r
- if (GetItemText(m_listCtrl, nIndex, 0) != str0)\r
+ if (GetItemText(m_listCtrl, nIndex, 0) != strSort)\r
{\r
m_listCtrl->DeleteItem(nIndex);\r
- nIndex = m_listCtrl->InsertItem(GetSortIndex(strSort), str0);\r
+ nIndex = m_listCtrl->InsertItem(GetSortIndex(strSort), strSort);\r
}\r
}\r
\r
- m_listCtrl->SetItem(nIndex, 1, hashKey.ToString());\r
+ m_listCtrl->SetItem(nIndex, 1, " " + hashKey.ToString());\r
m_listCtrl->SetItem(nIndex, 2, str2);\r
m_listCtrl->SetItem(nIndex, 3, str3);\r
m_listCtrl->SetItem(nIndex, 4, str4);\r
\r
// Find item\r
int nIndex = -1;\r
+ string strHash = " " + hashKey.ToString();\r
while ((nIndex = m_listCtrl->FindItem(nIndex, nData)) != -1)\r
- if (GetItemText(m_listCtrl, nIndex, 1) == hashKey.ToString())\r
+ if (GetItemText(m_listCtrl, nIndex, 1) == strHash)\r
break;\r
\r
if (nIndex != -1)\r
fUIDone = false;\r
fWorkDone = false;\r
#ifndef __WXMSW__\r
- SetSize(1.2 * GetSize().GetWidth(), 1.05 * GetSize().GetHeight());\r
+ SetSize(1.2 * GetSize().GetWidth(), 1.08 * GetSize().GetHeight());\r
#endif\r
\r
SetTitle(strprintf("Sending %s to %s", FormatMoney(nPrice).c_str(), wtx.mapValue["to"].c_str()));\r
return string(psz, psz + sizeof(pn)*2);\r
}\r
\r
- void SetHex(const std::string& str)\r
+ void SetHex(const char* psz)\r
{\r
for (int i = 0; i < WIDTH; i++)\r
pn[i] = 0;\r
\r
- // skip 0x\r
- const char* psz = str.c_str();\r
+ // skip leading spaces\r
while (isspace(*psz))\r
psz++;\r
+\r
+ // skip 0x\r
if (psz[0] == '0' && tolower(psz[1]) == 'x')\r
psz += 2;\r
- while (isspace(*psz))\r
- psz++;\r
\r
// hex string to uint\r
static char phexdigit[256] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,1,2,3,4,5,6,7,8,9,0,0,0,0,0,0, 0,0xa,0xb,0xc,0xd,0xe,0xf,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0xa,0xb,0xc,0xd,0xe,0xf,0,0,0,0,0,0,0,0,0 };\r
}\r
}\r
\r
+ void SetHex(const std::string& str)\r
+ {\r
+ SetHex(str.c_str());\r
+ }\r
+\r
std::string ToString() const\r
{\r
return (GetHex());\r