Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,20 @@ function broadcastStateTransitionHandlerFactory(
.update(stBytes)
.digest();

// TODO: Apply search filter to fetch specific state transition
// Throw an already exist in mempool error if the ST in mempool
const unconfirmedTxsResponse = await requestTenderRpc('unconfirmed_txs', { limit: 100 });
let unconfirmedTxResponse;
try {
unconfirmedTxResponse = await requestTenderRpc(
'unconfirmed_tx',
{ hash: `0x${stHash.toString('hex')}` },
);
} catch (e) {
if (typeof e.data !== 'string' || !e.data.includes('not found')) {
throw e;
}
}

if (unconfirmedTxsResponse?.txs?.includes(stBytes.toString('base64'))) {
if (unconfirmedTxResponse?.tx) {
throw new AlreadyExistsGrpcError('state transition already in mempool');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ describe('broadcastStateTransitionHandlerFactory', () => {
data: 'tx already exists in cache',
};

requestTenderRpcMock.withArgs('unconfirmed_txs').resolves({
txs: [stateTransitionFixture.toBuffer().toString('base64')],
requestTenderRpcMock.withArgs('unconfirmed_tx').resolves({
tx: stateTransitionFixture.toBuffer().toString('base64'),
});

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ export default function getBaseConfigFactory() {
tenderdash: {
mode: 'full',
docker: {
image: 'dashpay/tenderdash:1',
image: 'dashpay/tenderdash:1.5-dev',
},
p2p: {
host: '0.0.0.0',
Expand Down
7 changes: 7 additions & 0 deletions packages/dashmate/configs/getConfigFileMigrationsFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,13 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs)
});
return configFile;
},
'2.0.0-dev.2': (configFile) => {
Object.entries(configFile.configs)
.forEach(([, options]) => {
options.platform.drive.tenderdash.docker.image = 'dashpay/tenderdash:1.5-dev';
});
return configFile;
},
'2.0.0-rc.1': (configFile) => {
Object.entries(configFile.configs)
.forEach(([, options]) => {
Expand Down
Loading