Allow extra to be set for mined blocks

pull/239/head
obscuren 10 years ago
parent cc7f8f58e8
commit 47e6b2cef8
  1. 19
      cmd/mist/assets/qml/views/miner.qml
  2. 4
      cmd/mist/ui_lib.go
  3. 2
      miner/miner.go

@ -46,6 +46,7 @@ Rectangle {
text: "Start" text: "Start"
onClicked: { onClicked: {
eth.setGasPrice(minGasPrice.text || "10000000000000"); eth.setGasPrice(minGasPrice.text || "10000000000000");
eth.setExtra(blockExtra.text)
if (eth.toggleMining()) { if (eth.toggleMining()) {
this.text = "Stop"; this.text = "Stop";
} else { } else {
@ -55,6 +56,7 @@ Rectangle {
} }
Rectangle { Rectangle {
id: minGasPriceRect
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 2 anchors.topMargin: 2
width: 200 width: 200
@ -65,6 +67,23 @@ Rectangle {
validator: RegExpValidator { regExp: /\d*/ } validator: RegExpValidator { regExp: /\d*/ }
} }
} }
Rectangle {
width: 300
anchors {
left: minGasPriceRect.right
leftMargin: 5
top: parent.top
topMargin: 2
}
TextField {
id: blockExtra
placeholderText: "Extra"
width: parent.width
maximumLength: 1024
}
}
} }
} }

@ -279,6 +279,10 @@ func (self *UiLib) SetGasPrice(price string) {
self.miner.MinAcceptedGasPrice = ethutil.Big(price) self.miner.MinAcceptedGasPrice = ethutil.Big(price)
} }
func (self *UiLib) SetExtra(extra string) {
self.miner.Extra = extra
}
func (self *UiLib) ToggleMining() bool { func (self *UiLib) ToggleMining() bool {
if !self.miner.Mining() { if !self.miner.Mining() {
self.miner.Start() self.miner.Start()

@ -69,6 +69,7 @@ type Miner struct {
mining bool mining bool
MinAcceptedGasPrice *big.Int MinAcceptedGasPrice *big.Int
Extra string
} }
func New(coinbase []byte, eth *eth.Ethereum) *Miner { func New(coinbase []byte, eth *eth.Ethereum) *Miner {
@ -178,6 +179,7 @@ func (self *Miner) mine() {
chainMan = self.eth.ChainManager() chainMan = self.eth.ChainManager()
block = chainMan.NewBlock(self.Coinbase) block = chainMan.NewBlock(self.Coinbase)
) )
block.Header().Extra = self.Extra
// Apply uncles // Apply uncles
if len(self.uncles) > 0 { if len(self.uncles) > 0 {

Loading…
Cancel
Save