Exemplo n.º 1
0
void SellsPage::on_rejectButton_clicked()
{
    QItemSelectionModel* selectionModel = ui->buysTableWidget->selectionModel();
    QModelIndexList selected = selectionModel->selectedRows();
    if(selected.count() == 0)
        return;

    QModelIndex index = selected.at(0);
    int r = index.row();
    std::string id = ui->buysTableWidget->item(r, 4)->text().toStdString();
    uint256 listingIdHash = uint256(id);
    std::string rid = ui->buysTableWidget->item(r, 5)->text().toStdString();
    uint256 requestIdHash = uint256(rid);

    // ask the user if they really want to reject the buy request
    QMessageBox::StandardButton reply;
      reply = QMessageBox::question(this, "Reject Buy", "Are you sure you want to reject the buy request for this item?",
                                QMessageBox::Yes|QMessageBox::No);
    if (reply == QMessageBox::Yes) 
    {
	CBuyReject reject;
	reject.listingId = listingIdHash;
	reject.buyRequestId = requestIdHash;
	reject.nDate = GetTime();
	reject.sellerKey = pwalletMain->GenerateNewKey();
	SignBuyReject(reject, reject.vchSig);
	ReceiveBuyReject(reject);
	reject.BroadcastToAll();
	LoadSells();
	LoadBuyRequests();
    }
}
Exemplo n.º 2
0
Value marketcancelescrow(const Array& params, bool fHelp)
{
    if (fHelp || params.size() == 0)
        throw runtime_error("marketcancelescrow \n"
                            "Cancels a market escrow \n"
                            "parameters: <requestId>");

    string requestID = params[0].get_str();

    uint256 requestHashId = uint256(requestID);
    uint256 listingHashId = mapBuyRequests[requestHashId].listingId;

    CBuyReject reject;
    reject.listingId = listingHashId;
    reject.buyRequestId = requestHashId;
    reject.nDate = GetTime();
    reject.sellerKey = pwalletMain->GenerateNewKey();
    SignBuyReject(reject, reject.vchSig);
    ReceiveBuyReject(reject);
    reject.BroadcastToAll();

    return Value::null;
}