Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1QhMfP-0005rd-3f for bitcoin-development@lists.sourceforge.net; Thu, 14 Jul 2011 14:13:27 +0000 Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of bluematt.me designates 208.79.240.5 as permitted sender) client-ip=208.79.240.5; envelope-from=bitcoin-list@bluematt.me; helo=smtpauth.rollernet.us; Received: from smtpauth.rollernet.us ([208.79.240.5]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1QhMfM-00060C-MA for bitcoin-development@lists.sourceforge.net; Thu, 14 Jul 2011 14:13:27 +0000 Received: from smtpauth.rollernet.us (localhost [127.0.0.1]) by smtpauth.rollernet.us (Postfix) with ESMTP id 1443259400E for ; Thu, 14 Jul 2011 07:13:03 -0700 (PDT) Received: from mail.bluematt.me (unknown [IPv6:2001:470:9ff2:2:20c:29ff:fe16:f239]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: @bluematt.me) by smtpauth.rollernet.us (Postfix) with ESMTPSA for ; Thu, 14 Jul 2011 07:12:59 -0700 (PDT) Received: from [IPv6:2001:470:9ff2:1:2c0:caff:fe33:858b] (unknown [IPv6:2001:470:9ff2:1:2c0:caff:fe33:858b]) by mail.bluematt.me (Postfix) with ESMTPSA id 4C913B420 for ; Thu, 14 Jul 2011 16:13:05 +0200 (CEST) From: Matt Corallo To: bitcoin-development@lists.sourceforge.net In-Reply-To: References: Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-NV7sp+pSzgLcnfNPqc+r" Date: Thu, 14 Jul 2011 16:13:04 +0200 Message-ID: <1310652784.2284.192.camel@Desktop666> Mime-Version: 1.0 X-Mailer: Evolution 2.32.2 X-Rollernet-Abuse: Processed by Roller Network Mail Services. Contact abuse@rollernet.us to report violations. Abuse policy: http://rollernet.us/abuse.php X-Rollernet-Submit: Submit ID 3815.4e1ef96b.c8d3e.0 X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1QhMfM-00060C-MA Subject: Re: [Bitcoin-development] Notifications from client/wallet X-BeenThere: bitcoin-development@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2011 14:13:27 -0000 --=-NV7sp+pSzgLcnfNPqc+r Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable This sounds cool, I started implementing the other half of this a couple days ago. My broad idea of a source cleanup (that sipa largely wrote) is to have a central notification interface which wallet(s)/net/block store/etc all communicate with, and then an interface, like the one proposed here, which GUI/RPC/etc use to communicate with wallet/net. This should allow for very clean separation of pieces and large-scale rewrites of one or another part (or drop-in replacements) without touching anything but the parts that are being redone. This should also allow for cool programs (like pushpoold/a block notification server/etc) to use Bitcoin as a library fairly efficiently. Matt On Thu, 2011-07-14 at 05:19 +0000, John Smith wrote: > Hello all, >=20 > I'd like to add notifications to the client and wallet, to decouple UI > and core communication, and especially so that UIs no longer have to > poll for changes.=20 >=20 > I propose to use the boost::signal mechanism for that. It is basically > a glorified callback system, but allows decoupled delivery of > 'signals' from an object. Multiple other objects can listen in on an > event without the emitting object having to care.=20 >=20 > Wallet: >=20 > class CWallet { ... > boost::signal balanceChanged; > } >=20 >=20 > void CWallet::newTx (...) { >=20 > ... > balanceChanged(new_balance); > ... > } >=20 >=20 >=20 > UI: >=20 > GUI::GUI(CWallet *wallet) { > ... > wallet->balanceChanged.connect(boost::bind(&GUI::balanceChanged, > this, _1)); > } > GUI::balanceChanged(int64 new_balance) { > someWidget->setValue(new_balance); > } >=20 >=20 > Specific notifications that would be useful: >=20 > Wallet: > * balanceChanged(int64): spendable balance changed > * transactionAdded(int256): new transaction added to wallet > * transactionUpdated(int256): transaction info changed > * transactionRemoved(int256): transaction removed from wallet > (can this happen? for completeness) > * addressAdded(int160): address was added to address book > * addressUpdated(int160): address label/other metadata was > modified > * addressRemoved(int160): address was removed from address book > * notification(std::string message, int severity): warning/error > occured in wallet processing, notify user > * int askFee(std::string message, ...): ask user for fee > Network client: > * numConnectionsChanged(int): new connections / connections > broken > * numBlocksChanged(int): new blocks came in or other changes to > block chain > * notification(std::string message, int severity): warning/error > occured in network processing, notify user >=20 > JS --=-NV7sp+pSzgLcnfNPqc+r Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAABAgAGBQJOHvlnAAoJEBrh01BD4I5UePEP/3UufxZXec2JWsoj1J6h0FKH xPAvsSJQetK7X4S50CYuSydTU9l/wORE6tcsYjsG6RZQvceaWZ1YKT0MDxiOcG/w TH1F7AycUsVh8kDED9wZAnEMsqFlZaqbJ2UJ8718eaE9ZUx+Za/iJkAWHfNHyMNF LqqSiUAdHcm6z7g/+1D8sLPrpe+ePSrpyA8z+Vql3tXYjShgJ3a/Po+VmToW3Fr2 fhVt5gxeoXGPIsDNvSpE6f865hM9LUN1zzb7v5MJBf94zmLAtGnfEMag7TXJpN5m J/iOjb9Blo917eeJ6YBAjkO8Yqufl5XPhz2g6iCyTdm1IFwvTowORLezfd1/ipxP YBOCSfLuGeAGGNge6X/vOp6IQDbgBQWkPzSweMr7rlZ3XLGlibAt9aqbKyn/OU8I IIznbobKLnD6HDrL9FnppXyiZEjASRF0pjdfsVLq84g6vYkBXmrtBUMHiqqP0DH6 0KfQVdNVIHxYziTo2otiTD+G4MjVA8VZ9rYUhZvibnrugpsOYmNSkAby+7YQVPNC aaHWrvkG3fgT058DJ3iZs+CUImuxVSclFza8Tx+pH3r5weL1J+nuDQEn8gMn/dPr Zpp5Xivcv5Vizb+Fyb4XecxHPipLwfHKnRXzG9UMX8mmh23gyHaN7WQnMAp1Q6cX 31RJTmNf92Ctfbdy/GsH =3kwJ -----END PGP SIGNATURE----- --=-NV7sp+pSzgLcnfNPqc+r--